summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-01 00:49:57 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-01 00:49:57 +0000
commitc31c9f964a81f104f4c265b6082b469361fb1653 (patch)
treeff99939150d948ed8e8a1fb1139eb8fac778e69b /spec/support
parentc6c26f3b730d4bbc567aee33b4c6fd621517055e (diff)
downloadgitlab-ce-c31c9f964a81f104f4c265b6082b469361fb1653.tar.gz
Add latest changes from gitlab-org/security/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/graphql_helpers.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index 4857fa63114..38cf828ca5e 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -400,8 +400,13 @@ module GraphqlHelpers
post api('/', current_user, version: 'graphql'), params: { _json: queries }, headers: headers
end
- def post_graphql(query, current_user: nil, variables: nil, headers: {}, token: {})
- params = { query: query, variables: serialize_variables(variables) }
+ def get_multiplex(queries, current_user: nil, headers: {})
+ path = "/?#{queries.to_query('_json')}"
+ get api(path, current_user, version: 'graphql'), headers: headers
+ end
+
+ def post_graphql(query, current_user: nil, variables: nil, headers: {}, token: {}, params: {})
+ params = params.merge(query: query, variables: serialize_variables(variables))
post api('/', current_user, version: 'graphql', **token), params: params, headers: headers
return unless graphql_errors
@@ -410,6 +415,18 @@ module GraphqlHelpers
expect(graphql_errors).not_to include(a_hash_including('message' => 'Internal server error'))
end
+ def get_graphql(query, current_user: nil, variables: nil, headers: {}, token: {}, params: {})
+ vars = "variables=#{CGI.escape(serialize_variables(variables))}" if variables
+ params = params.to_a.map { |k, v| v.to_query(k) }
+ path = ["/?query=#{CGI.escape(query)}", vars, *params].join('&')
+ get api(path, current_user, version: 'graphql', **token), headers: headers
+
+ return unless graphql_errors
+
+ # Errors are acceptable, but not this one:
+ expect(graphql_errors).not_to include(a_hash_including('message' => 'Internal server error'))
+ end
+
def post_graphql_mutation(mutation, current_user: nil, token: {})
post_graphql(mutation.query,
current_user: current_user,