Fail E2E tests early if template not found via API
This commit is contained in:
parent
681fca60f6
commit
99327de207
|
@ -12,6 +12,10 @@ module QA
|
||||||
@session_address = Runtime::Address.new(api_client.address, request_path)
|
@session_address = Runtime::Address.new(api_client.address, request_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mask_url
|
||||||
|
@session_address.address.sub(/private_token=.*/, "private_token=[****]")
|
||||||
|
end
|
||||||
|
|
||||||
def url
|
def url
|
||||||
@session_address.address
|
@session_address.address
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,10 +3,19 @@
|
||||||
module QA
|
module QA
|
||||||
module Runtime
|
module Runtime
|
||||||
module Fixtures
|
module Fixtures
|
||||||
|
include Support::Api
|
||||||
|
|
||||||
|
TemplateNotFoundError = Class.new(RuntimeError)
|
||||||
|
|
||||||
def fetch_template_from_api(api_path, key)
|
def fetch_template_from_api(api_path, key)
|
||||||
request = Runtime::API::Request.new(api_client, "/templates/#{api_path}/#{key}")
|
request = Runtime::API::Request.new(api_client, "/templates/#{api_path}/#{key}")
|
||||||
get request.url
|
response = get(request.url)
|
||||||
json_body[:content]
|
|
||||||
|
unless response.code == HTTP_STATUS_OK
|
||||||
|
raise TemplateNotFoundError, "Template at #{request.mask_url} could not be found (#{response.code}): `#{response}`."
|
||||||
|
end
|
||||||
|
|
||||||
|
parse_body(response)[:content]
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue