diff options
Diffstat (limited to 'qa/qa/resource/protected_branch.rb')
-rw-r--r-- | qa/qa/resource/protected_branch.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/qa/qa/resource/protected_branch.rb b/qa/qa/resource/protected_branch.rb index 7db6450acf8..062d4e9f3d8 100644 --- a/qa/qa/resource/protected_branch.rb +++ b/qa/qa/resource/protected_branch.rb @@ -61,6 +61,8 @@ module QA end def fabricate_via_api! + resource_web_url(api_get) + rescue ResourceNotFoundError populate_new_branch_if_required super @@ -75,7 +77,11 @@ module QA end def api_delete_path - "/projects/#{project.id}/protected_branches/#{branch_name}" + api_get_path + end + + def api_put_path + api_get_path end def api_post_path @@ -107,6 +113,16 @@ module QA # this particular resource does not expose a web_url property end + def set_require_code_owner_approval(require = true) + response = patch(Runtime::API::Request.new(api_client, api_put_path).url, { code_owner_approval_required: require }) + return if response.code == HTTP_STATUS_OK + + raise( + ResourceUpdateFailedError, + "Could not update code_owner_approval_required to #{require}. Request returned (#{response.code}): `#{response}`." + ) + end + class Roles NO_ONE = { description: 'No one', access_level: 0 }.freeze DEVS_AND_MAINTAINERS = { description: 'Developers + Maintainers', access_level: 30 }.freeze |