diff options
Diffstat (limited to 'qa/qa/resource/user.rb')
-rw-r--r-- | qa/qa/resource/user.rb | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb index 811ce5e0505..ed4ea057484 100644 --- a/qa/qa/resource/user.rb +++ b/qa/qa/resource/user.rb @@ -7,13 +7,18 @@ module QA attr_reader :unique_id attr_writer :username, :password - attr_accessor :admin, :provider, :extern_uid, :expect_fabrication_success, :hard_delete_on_api_removal - - attribute :id - attribute :name - attribute :first_name - attribute :last_name - attribute :email + attr_accessor :admin, + :provider, + :extern_uid, + :expect_fabrication_success, + :hard_delete_on_api_removal, + :access_level + + attributes :id, + :name, + :first_name, + :last_name, + :email def initialize @admin = false @@ -123,6 +128,10 @@ module QA "/users/#{id}/block" end + def api_approve_path + "/users/#{id}/approve" + end + def api_post_body { admin: admin, @@ -148,6 +157,13 @@ module QA end end + def approve! + response = post(Runtime::API::Request.new(api_client, api_approve_path).url, nil) + return if response.code == 201 + + raise ResourceUpdateFailedError, "Failed to approve user. Request returned (#{response.code}): `#{response}`" + end + def block! response = post(Runtime::API::Request.new(api_client, api_block_path).url, nil) return if response.code == HTTP_STATUS_CREATED |