Sha256: 3326d922f8f79799b3b26bcc8752f7ef1ba0726a7ce764f92446d1b1789e2234

Contents?: true

Size: 1.12 KB

Versions: 22

Compression:

Stored size: 1.12 KB

Contents

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

describe "RhoconnectApiUpdateUser" do
  it_should_behave_like "ApiHelper" do 
    it "should update user successfully" do
      post "/api/user/update_user", :api_token => @api_token, 
        :attributes => {:new_password => '123'}
      last_response.should be_ok
      user = User.authenticate('rhoadmin','123')
      user.login.should == 'rhoadmin'
      user.admin.should == 1
    end

    it "should fail to update user with wrong attributes" do
      post "/api/user/update_user", :api_token => @api_token,
        :attributes => {:missingattrib => '123'}
      last_response.status.should == 500
      last_response.body.match('undefined method').should_not be_nil
    end

    it "should not update login attribute for user" do
      post "/api/user/update_user", :api_token => @api_token, 
        :attributes => {:new_password => '123', :login => 'admin1'}
      last_response.should be_ok
      user = User.authenticate('rhoadmin','123')
      user.login.should == 'rhoadmin'
      user.admin.should == 1
      User.is_exist?('admin1').should == false
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rhoconnect-3.2.1 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0.beta5 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0.beta4 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0.beta3 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0.beta2 spec/api/user/update_user_spec.rb
rhoconnect-3.2.0.beta1 spec/api/user/update_user_spec.rb
rhoconnect-3.1.2 spec/api/user/update_user_spec.rb
rhoconnect-3.1.1 spec/api/user/update_user_spec.rb
rhoconnect-3.1.0 spec/api/user/update_user_spec.rb
rhoconnect-3.1.0.beta2 spec/api/user/update_user_spec.rb
rhoconnect-3.1.0.beta1 spec/api/user/update_user_spec.rb
rhoconnect-3.0.6 spec/api/user/update_user_spec.rb
rhoconnect-3.0.5 spec/api/user/update_user_spec.rb
rhoconnect-3.0.4 spec/api/user/update_user_spec.rb
rhoconnect-3.0.3 spec/api/user/update_user_spec.rb
rhoconnect-3.0.2 spec/api/user/update_user_spec.rb
rhoconnect-3.0.1 spec/api/user/update_user_spec.rb
rhoconnect-3.0.0 spec/api/user/update_user_spec.rb
rhoconnect-3.0.0.rc1 spec/api/user/update_user_spec.rb