summaryrefslogtreecommitdiff
path: root/qa/qa/resource/group.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/group.rb')
-rw-r--r--qa/qa/resource/group.rb43
1 files changed, 17 insertions, 26 deletions
diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb
index fb7236f9f4c..c7565871b0b 100644
--- a/qa/qa/resource/group.rb
+++ b/qa/qa/resource/group.rb
@@ -2,10 +2,8 @@
module QA
module Resource
- class Group < Base
- include Members
-
- attr_accessor :path, :description
+ class Group < GroupBase
+ attr_accessor :description
attribute :sandbox do
Sandbox.fabricate_via_api! do |sandbox|
@@ -13,10 +11,6 @@ module QA
end
end
- attribute :full_path
- attribute :id
- attribute :name
- attribute :runners_token
attribute :require_two_factor_authentication
def initialize
@@ -59,14 +53,6 @@ module QA
"/groups/#{CGI.escape("#{sandbox.path}/#{path}")}"
end
- def api_put_path
- "/groups/#{id}"
- end
-
- def api_post_path
- '/groups'
- end
-
def api_post_body
{
parent_id: sandbox.id,
@@ -77,17 +63,14 @@ module QA
}
end
- def api_delete_path
- "/groups/#{id}"
- end
-
def set_require_two_factor_authentication(value:)
put_body = { require_two_factor_authentication: value }
response = put Runtime::API::Request.new(api_client, api_put_path).url, put_body
+ return if response.code == HTTP_STATUS_OK
- unless response.code == HTTP_STATUS_OK
- raise ResourceUpdateFailedError, "Could not update require_two_factor_authentication to #{value}. Request returned (#{response.code}): `#{response}`."
- end
+ raise(ResourceUpdateFailedError, <<~ERROR.strip)
+ Could not update require_two_factor_authentication to #{value}. Request returned (#{response.code}): `#{response}`.
+ ERROR
end
def change_repository_storage(new_storage)
@@ -95,12 +78,20 @@ module QA
response = post Runtime::API::Request.new(api_client, "/groups/#{id}/repository_storage_moves").url, post_body
unless response.code.between?(200, 300)
- raise ResourceUpdateFailedError, "Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`."
+ raise(
+ ResourceUpdateFailedError,
+ "Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`."
+ )
end
- wait_until(sleep_interval: 1) { Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage) }
+ wait_until(sleep_interval: 1) do
+ Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage)
+ end
rescue Support::Repeater::RepeaterConditionExceededError
- raise Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError, 'Timed out while waiting for the group repository storage move to finish'
+ raise(
+ Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError,
+ 'Timed out while waiting for the group repository storage move to finish'
+ )
end
end
end