Sha256: 5aca4d2b3b3bc4197ea9642be4ff6c687f398cf81070c26ffdda68d33b5d2922

Contents?: true

Size: 785 Bytes

Versions: 7

Compression:

Stored size: 785 Bytes

Contents

require File.join(File.dirname(__FILE__),'api_helper')

describe "RhosyncApiGetApiToken" do
  it_should_behave_like "ApiHelper"
  
  it "should get token string" do
    post "/login", :login => 'admin',:password => ''
    post "/api/get_api_token"
    last_response.body.should == @api_token
  end
  
  it "should fail to get token if user is not admin" do
    post "/login", :login => @u_fields[:login],:password => 'testpass'
    post "/api/get_api_token"
    last_response.status.should == 422    
    last_response.body.should == 'Invalid/missing API user'
  end  
  
  it "should return 422 if no token provided" do
    params = {:attributes => {:login => 'testuser1', :password => 'testpass1'}}
    post "/api/create_user", params
    last_response.status.should == 422
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rhosync-2.0.0.beta9 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta8 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta7 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta6 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta4 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta3 spec/api/get_api_token_spec.rb
rhosync-2.0.0.beta2 spec/api/get_api_token_spec.rb