Sha256: 0b1260742e1ff6dd559dcec50a5986d2407d56a28c36740108578719e357267c

Contents?: true

Size: 1.04 KB

Versions: 41

Compression:

Stored size: 1.04 KB

Contents

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

describe "RhosyncApiUpdateUser" do
  it_should_behave_like "ApiHelper"
  
  it "should update user successfully" do
    post "/api/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/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/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

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
rhosync-2.1.2 spec/api/update_user_spec.rb
rhosync-2.1.1 spec/api/update_user_spec.rb
rhosync-2.1.0 spec/api/update_user_spec.rb
rhosync-2.1.0.beta.2 spec/api/update_user_spec.rb
rhosync-2.1.0.beta.1 spec/api/update_user_spec.rb
rhosync-2.0.9 spec/api/update_user_spec.rb
rhosync-2.0.8 spec/api/update_user_spec.rb
rhosync-2.0.7 spec/api/update_user_spec.rb
rhosync-2.0.6 spec/api/update_user_spec.rb
rhosync-2.0.5 spec/api/update_user_spec.rb
rhosync-2.0.4 spec/api/update_user_spec.rb
rhosync-2.0.3 spec/api/update_user_spec.rb
rhosync-2.0.2 spec/api/update_user_spec.rb
rhosync-2.0.1 spec/api/update_user_spec.rb
rhosync-2.0.0 spec/api/update_user_spec.rb
rhosync-2.0.0.rc2 spec/api/update_user_spec.rb
rhosync-2.0.0.rc1 spec/api/update_user_spec.rb
rhosync-2.0.0.beta13 spec/api/update_user_spec.rb
rhosync-2.0.0.beta12 spec/api/update_user_spec.rb
rhosync-2.0.0.beta11 spec/api/update_user_spec.rb