Commit 588ff19a authored by Sanad Liaquat's avatar Sanad Liaquat

Fix unit tests

parent 4fad0ace
...@@ -54,10 +54,8 @@ module QA ...@@ -54,10 +54,8 @@ module QA
end end
def api_get_from(get_path) def api_get_from(get_path)
response = RestClient::Request.execute( url = Runtime::API::Request.new(api_client, get_path).url
method: :get, response = get(url)
url: Runtime::API::Request.new(api_client, get_path).url,
verify_ssl: false)
unless response.code == HTTP_STATUS_OK unless response.code == HTTP_STATUS_OK
raise ResourceNotFoundError, "Resource at #{url} could not be found (#{response.code}): `#{response}`." raise ResourceNotFoundError, "Resource at #{url} could not be found (#{response.code}): `#{response}`."
...@@ -67,11 +65,9 @@ module QA ...@@ -67,11 +65,9 @@ module QA
end end
def api_post def api_post
response = RestClient::Request.execute( response = post(
method: :post, Runtime::API::Request.new(api_client, api_post_path).url,
url: Runtime::API::Request.new(api_client, api_post_path).url, api_post_body)
payload: api_post_body,
verify_ssl: false)
unless response.code == HTTP_STATUS_CREATED unless response.code == HTTP_STATUS_CREATED
raise ResourceFabricationFailedError, "Fabrication of #{self.class.name} using the API failed (#{response.code}) with `#{response}`." raise ResourceFabricationFailedError, "Fabrication of #{self.class.name} using the API failed (#{response.code}) with `#{response}`."
...@@ -98,6 +94,21 @@ module QA ...@@ -98,6 +94,21 @@ module QA
def transform_api_resource(api_resource) def transform_api_resource(api_resource)
api_resource api_resource
end end
def post(url, payload)
RestClient::Request.execute(
method: :post,
url: url,
payload: payload,
verify_ssl: false)
end
def get(url)
RestClient::Request.execute(
method: :get,
url: url,
verify_ssl: false)
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment