Sha256: 17a51fbcede3cd203e4fe44174eb00c079c60c20d83421471f0a0bae3a5fc721

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

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 => 'rhoadmin',:password => ''
    post "/api/get_api_token"
    last_response.body.should == @api_token
  end
  
  it "response should have cache-control and pragma headers set to no-cache" do
    post "/login", :login => 'rhoadmin',:password => ''
    last_response.headers['Cache-Control'].should == 'no-cache'
    last_response.headers['Pragma'].should == 'no-cache'
  end
  
  it "should fail to get token if user is not rhoadmin" 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

14 entries across 14 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 spec/api/get_api_token_spec.rb
rhosync-2.1.18.beta1 spec/api/get_api_token_spec.rb
rhosync-2.1.17 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta7 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta6 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta5 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta4 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta3 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta2 spec/api/get_api_token_spec.rb
rhosync-2.1.17.beta1 spec/api/get_api_token_spec.rb
rhosync-2.1.16 spec/api/get_api_token_spec.rb
rhosync-2.1.15 spec/api/get_api_token_spec.rb
rhosync-2.1.14 spec/api/get_api_token_spec.rb
rhosync-2.1.13 spec/api/get_api_token_spec.rb