Sha256: aae3943b3eaa89ea46154442561c21bfae0f06028ee39bf75b8e0c42bd4835a4
Contents?: true
Size: 1.4 KB
Versions: 9
Compression:
Stored size: 1.4 KB
Contents
require File.join(File.dirname(__FILE__),'..','api_helper') describe "RhoconnectApiGetApiToken" do it_should_behave_like "ApiHelper" do it "should login and receive the token string" do post "/api/admin/login", :login => 'rhoadmin',:password => '' last_response.body.should == @api_token end it "should login using the old route and show deprecation warning" do post "/login", :login => 'rhoadmin',:password => '' last_response.body.should == @api_token last_response.headers["Warning"].index('deprecated').should_not == nil end it "should get deprecation warning for get_api_token method" do post "/api/admin/login", :login => 'rhoadmin',:password => '' post "/api/admin/get_api_token" last_response.body.should == @api_token last_response.headers['Warning'].index('deprecated').should_not == nil end it "should fail to login and get token if user is not rhoadmin" do Rhoconnect.appserver = nil post "/api/admin/login", :login => @u_fields[:login],:password => 'testpass' 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/user/create_user", params last_response.status.should == 422 end end end
Version data entries
9 entries across 9 versions & 1 rubygems