summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorSanad Liaquat <sliaquat@gitlab.com>2018-11-19 18:01:38 +0500
committerSanad Liaquat <sliaquat@gitlab.com>2018-11-26 13:04:48 +0500
commit553a65df04fc4720ad8abbe2606118766595b807 (patch)
tree2aa0d6cbfbb903123d6c9221cab04e6fb7eb07fe /qa
parent84cb5f1322edd1f3d05ac92fa671ff3e366cd8c4 (diff)
downloadgitlab-ce-553a65df04fc4720ad8abbe2606118766595b807.tar.gz
Port ee changes
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/resource/api_fabricator.rb24
-rw-r--r--qa/qa/support/api.rb28
3 files changed, 30 insertions, 23 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index c0d5244dbfa..aa0b78b37e8 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -329,6 +329,7 @@ module QA
module Page
autoload :Logging, 'qa/support/page/logging'
end
+ autoload :Api, 'qa/support/api'
end
end
diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb
index 397dfb16aa4..98eebac0880 100644
--- a/qa/qa/resource/api_fabricator.rb
+++ b/qa/qa/resource/api_fabricator.rb
@@ -41,6 +41,7 @@ module QA
private
+ include Support::Api
attr_writer :api_resource, :api_response
def resource_web_url(resource)
@@ -82,10 +83,6 @@ module QA
end
end
- def parse_body(response)
- JSON.parse(response.body, symbolize_names: true)
- end
-
def process_api_response(parsed_response)
self.api_response = parsed_response
self.api_resource = transform_api_resource(parsed_response.deep_dup)
@@ -94,25 +91,6 @@ module QA
def transform_api_resource(api_resource)
api_resource
end
-
- def post(url, payload)
- RestClient::Request.execute(
- method: :post,
- url: url,
- payload: payload,
- verify_ssl: false)
- rescue RestClient::ExceptionWithResponse => e
- e.response
- end
-
- def get(url)
- RestClient::Request.execute(
- method: :get,
- url: url,
- verify_ssl: false)
- rescue RestClient::ExceptionWithResponse => e
- e.response
- end
end
end
end
diff --git a/qa/qa/support/api.rb b/qa/qa/support/api.rb
new file mode 100644
index 00000000000..1107d43161e
--- /dev/null
+++ b/qa/qa/support/api.rb
@@ -0,0 +1,28 @@
+module QA
+ module Support
+ module Api
+ def post(url, payload)
+ RestClient::Request.execute(
+ method: :post,
+ url: url,
+ payload: payload,
+ verify_ssl: false)
+ rescue RestClient::ExceptionWithResponse => e
+ e.response
+ end
+
+ def get(url)
+ RestClient::Request.execute(
+ method: :get,
+ url: url,
+ verify_ssl: false)
+ rescue RestClient::ExceptionWithResponse => e
+ e.response
+ end
+
+ def parse_body(response)
+ JSON.parse(response.body, symbolize_names: true)
+ end
+ end
+ end
+end