Test openapi schema of Auth passwordless

This commit is contained in:
2021-03-16 01:28:26 +01:00
parent 0cf1aea9bf
commit c07a57a591
2 changed files with 38 additions and 6 deletions

View File

@@ -59,11 +59,13 @@ fun TestApplicationResponse.`And the schema response body must be valid`(content
ObjectMapper().readTree(content)
else TextNode("")
getResponse(status?.value?.toString() ?: error("HttpStatus not found"))
?.getContentMediaType(contentType.toString())
?.schema
?.validate(api, responseContent)
?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""")
val response = getResponse(status?.value?.toString() ?: error("HttpStatus not found")) ?: fail("""No Status "${status.value}" found for "$this $uri".""")
val schema = response.getContentMediaType(contentType.toString())?.schema
if (content != null) {
schema?.validate(api, responseContent)
?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""")
}
}
}
}