diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-03 03:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-03 03:10:17 +0300 |
commit | 1b10a6d769a97e4a2e5a65d8b7f3cb9c6d44e260 (patch) | |
tree | 4635a3a75aa34533e7148a118dfda91e4e8cdfd8 /qa | |
parent | 68da8a6cb432996324a4c2fe4dca70ae260ce73f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/resource/api_fabricator.rb | 19 | ||||
-rw-r--r-- | qa/qa/resource/group.rb | 7 | ||||
-rw-r--r-- | qa/qa/resource/sandbox.rb | 7 |
3 files changed, 32 insertions, 1 deletions
diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index 667dbc03fc3..d1cfdfbc16c 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -74,6 +74,13 @@ module QA response.code == HTTP_STATUS_OK end + # Parameters included in the query URL + # + # @return [Hash] + def query_parameters + @query_parameters ||= {} + end + private def resource_web_url(resource) @@ -87,7 +94,8 @@ module QA end def api_get_from(get_path) - request = Runtime::API::Request.new(api_client, get_path) + path = "#{get_path}#{query_parameters_to_string}" + request = Runtime::API::Request.new(api_client, path) response = get(request.url) if response.code == HTTP_STATUS_SERVER_ERROR @@ -101,6 +109,15 @@ module QA response end + # Query parameters formatted as `?key1=value1&key2=value2...` + # + # @return [String] + def query_parameters_to_string + query_parameters.each_with_object([]) do |(k, v), arr| + arr << "#{k}=#{v}" + end.join('&').prepend('?').chomp('?') # prepend `?` unless the string is blank + end + def api_post process_api_response(api_post_to(api_post_path, api_post_body)) end diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index 8a830303b56..60f6cbdfc51 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -61,6 +61,13 @@ module QA "/groups/#{CGI.escape(determine_full_path)}" end + # Parameters included in the query URL + # + # @return [Hash] + def query_parameters + super.merge({ with_projects: false }) + end + def api_post_body { parent_id: sandbox.id, diff --git a/qa/qa/resource/sandbox.rb b/qa/qa/resource/sandbox.rb index 8e7527bccd4..12ecce1ce9a 100644 --- a/qa/qa/resource/sandbox.rb +++ b/qa/qa/resource/sandbox.rb @@ -57,6 +57,13 @@ module QA "/groups/#{path}" end + # Parameters included in the query URL + # + # @return [Hash] + def query_parameters + super.merge({ with_projects: false }) + end + def api_post_body { path: path, |