$:.push File.expand_path("../../lib", __FILE__)
require 'helix_web_services_client'
require_relative './util/test_config'
require_relative './util/string_utils'
require 'pp'
api = api_as_super
rand = random_string
user_id = "test-user-#{random_string}"
user_command = HelixWebServices::UserCommand.new(
user: user_id,
fullName: 'Test User',
email: "#{user_id}@example.com",
jobView: "Owned-By=#{user_id}&status=open",
reviews: ['//depot/dev/...', '//depot/main/...']
)
api.server_users_post('localhost', user_command)
all_users = api.server_users_get('localhost')
unless all_users.any? { |b| b.user == user_id }
raise "Did not locate user #{user_id}"
end
saved_user = api.server_users_user_get('localhost', user_id)
unless saved_user.full_name == user_command.full_name
raise 'full_name not saved'
end
unless saved_user.job_view == user_command.job_view
raise 'job view not saved'
end
unless saved_user.reviews == user_command.reviews
raise 'reviews not saved'
end
to_update = HelixWebServices::UserCommand.new(
fullName: "Update #{rand}"
)
api.server_users_user_patch('localhost', user_id, to_update)
updated = api.server_users_user_get('localhost', user_id)
raise 'user not updated' if updated.full_name.strip != to_update.full_name.strip
api.server_users_user_delete('localhost', user_id)
all_users2 = api.server_users_get('localhost')
if all_users2.any? { |b| b.user == user_id }
raise "Did not delete user #{user_id}"
end
# |
Change |
User |
Description |
Committed |
|
#1
|
19553 |
swellard |
Move and rename clients |
|
|
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/ruby/test/default_api.server_users.crud.rb |
#1
|
19199 |
tjuricek |
Ruby Client SDK tests, labels through users. |
|
|