Skip to content
Snippets Groups Projects
Commit 6922bcab authored by Mark Lapierre's avatar Mark Lapierre :palm_tree: Committed by Tiffany Rea
Browse files

Fetch groups without projects in QA tests

parent 7adcaa9b
No related branches found
No related tags found
1 merge request!93512Fetch groups without projects in QA tests
......@@ -74,6 +74,13 @@ def exists?
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 @@ def api_get
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 @@ def api_get_from(get_path)
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
......
......@@ -61,6 +61,13 @@ def api_get_path
"/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,
......
......@@ -57,6 +57,13 @@ def api_get_path
"/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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment