Test openapi schema of Auth passwordless
This commit is contained in:
@@ -310,7 +310,6 @@ paths:
|
|||||||
example:
|
example:
|
||||||
azerty
|
azerty
|
||||||
format: password
|
format: password
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: User created and JWT returned
|
description: User created and JWT returned
|
||||||
@@ -331,6 +330,37 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
description: sdf
|
description: sdf
|
||||||
|
/auth/passwordless:
|
||||||
|
post:
|
||||||
|
summary: Send a connexion link by email
|
||||||
|
description: Send a connexion link by email with the token required to the connexion
|
||||||
|
externalDocs:
|
||||||
|
description: Explanation of Passwordless auth
|
||||||
|
url: https://en.wikipedia.org/wiki/Passwordless_authentication
|
||||||
|
tags:
|
||||||
|
- authentification
|
||||||
|
operationId: passwordless
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: email to send the token
|
||||||
|
example:
|
||||||
|
my.email@dc-project.fr
|
||||||
|
url:
|
||||||
|
type: string
|
||||||
|
description: url tu redirect with the token
|
||||||
|
example:
|
||||||
|
http://dc-project.fr/auth/passwordless
|
||||||
|
responses:
|
||||||
|
204:
|
||||||
|
description: email send
|
||||||
|
404:
|
||||||
|
description: no user with this email
|
||||||
|
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
|
|||||||
@@ -59,14 +59,16 @@ fun TestApplicationResponse.`And the schema response body must be valid`(content
|
|||||||
ObjectMapper().readTree(content)
|
ObjectMapper().readTree(content)
|
||||||
else TextNode("")
|
else TextNode("")
|
||||||
|
|
||||||
getResponse(status?.value?.toString() ?: error("HttpStatus not found"))
|
val response = getResponse(status?.value?.toString() ?: error("HttpStatus not found")) ?: fail("""No Status "${status.value}" found for "$this $uri".""")
|
||||||
?.getContentMediaType(contentType.toString())
|
val schema = response.getContentMediaType(contentType.toString())?.schema
|
||||||
?.schema
|
|
||||||
?.validate(api, responseContent)
|
if (content != null) {
|
||||||
|
schema?.validate(api, responseContent)
|
||||||
?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""")
|
?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun TestApplicationResponse.`And the schema parameters must be valid`() {
|
fun TestApplicationResponse.`And the schema parameters must be valid`() {
|
||||||
operation { api, uri ->
|
operation { api, uri ->
|
||||||
|
|||||||
Reference in New Issue
Block a user