# Copyright (c) 2014 Perforce Software, Inc. All rights reserved. require 'rspec' require 'helix_web_services_client' require_relative './test_config' RSpec.describe 'HelixWebServicesClient users' do randstr = (0...8).map { (65 + rand(26)).chr }.join new_user = { 'User' => "test_#{randstr}", 'FullName' => "Test #{randstr}", 'Email' => "test_#{randstr}@example.com" } it "should at least return the 'jdoe' and 'super' users" do client_as_jdoe do |c| users = c.users expect(users.length).to be >= 2 logins = users.map(&:user) expect(logins).to include('jdoe') expect(logins).to include('super') end end it "should return the user 'mmustermann' who has the name 'Max Mustermann'" do client_as_jdoe do |c| max = c.user_details('mmustermann') expect(max.full_name).to eq('Max Mustermann') end end it 'should be able to create a new user and load it' do client_as_super do |c| c.create_user(new_user) loaded = c.user_details(new_user['User']) expect(loaded.user).to eq(new_user['User']) expect(loaded.full_name).to eq(new_user['FullName']) expect(loaded.email).to eq(new_user['Email']) end end it "should be able update mmusterman's email to max_power@example.com" do client_as_super do |c| max_user = c.user_details('mmustermann') randstr = (0...8).map { (65 + rand(26)).chr }.join new_email = "max_mower_#{randstr}@example.com" max_user.email = new_email c.update_user(max_user) loaded = c.user_details('mmustermann') expect(loaded.email).to eq(new_email) end end it 'should be able to delete the newuser user' do client_as_super do |c| c.delete_user(new_user['User']) users = c.users expect(users.find { |u| u.user == new_user['User'] }).to be nil end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/helix_web_services_client/spec/users_spec.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/spec/users_spec.rb | |||||
#2 | 15188 | tjuricek | Execute user modification commands as the super user in tests. | ||
#1 | 15185 | tjuricek | Update user spec management implementation, tests, and documentation. | ||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/spec.old/perforce/users_spec.rb | |||||
#1 | 15053 | tjuricek |
Revise the client API to use the new login method. The current specs will need to be revised since data normalization is moving out of the server and into the client. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/spec/perforce/users_spec.rb | |||||
#1 | 13808 | tjuricek | Finish converting most of the core p4d API into the new monolithic system. |