Sha256: 2de6d44103bc94e677b9a0c7d36c50fb59f74a756e48b0e6908d0b7c22c48714

Contents?: true

Size: 1.31 KB

Versions: 13

Compression:

Stored size: 1.31 KB

Contents

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

describe "RhoconnectApiListUsers" do
  it_should_behave_like "ApiHelper" do
    it "should list users" do
      params = {:attributes => {:login => 'testuser1', :password => 'testpass1'}}
      post "/rc/#{Rhoconnect::API_VERSION}/users", params, {Rhoconnect::API_TOKEN_HEADER => @api_token}
      last_response.should be_ok
      get "/rc/#{Rhoconnect::API_VERSION}/users", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
      JSON.parse(last_response.body).sort.should == ["testuser", "testuser1"].sort
    end

    it "should handle empty user's list" do
      @a.delete; @a = App.create(@a_fields)
      get "/rc/#{Rhoconnect::API_VERSION}/users", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
      JSON.parse(last_response.body).should == []    
    end
    
    it "should show the deprecation warning on /api/list users" do
      params = {:api_token => @api_token,
        :attributes => {:login => 'testuser1', :password => 'testpass1'}}
      post "/rc/#{Rhoconnect::API_VERSION}/users", params
      last_response.should be_ok
      post "/api/list_users", {:api_token => @api_token}
      JSON.parse(last_response.body).sort.should == ["testuser", "testuser1"].sort
      last_response.headers['Warning'].index('deprecated').should_not == nil
    end
  end  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rhoconnect-3.4.5 spec/api/user/list_users_spec.rb
rhoconnect-3.4.4 spec/api/user/list_users_spec.rb
rhoconnect-3.4.3 spec/api/user/list_users_spec.rb
rhoconnect-3.4.2 spec/api/user/list_users_spec.rb
rhoconnect-3.3.6 spec/api/user/list_users_spec.rb
rhoconnect-3.3.5 spec/api/user/list_users_spec.rb
rhoconnect-3.3.4 spec/api/user/list_users_spec.rb
rhoconnect-3.3.3 spec/api/user/list_users_spec.rb
rhoconnect-3.3.2 spec/api/user/list_users_spec.rb
rhoconnect-3.3.1 spec/api/user/list_users_spec.rb
rhoconnect-3.3.1.beta4 spec/api/user/list_users_spec.rb
rhoconnect-3.3.1.beta3 spec/api/user/list_users_spec.rb
rhoconnect-3.3.1.beta2 spec/api/user/list_users_spec.rb