This commit is contained in:
2021-03-20 22:55:49 +01:00
parent e19266d4cc
commit 52183abd08
15 changed files with 245 additions and 207 deletions

View File

@@ -1,18 +1,18 @@
package integration
import integration.steps.`when`.Validate
import integration.steps.then.`And have property`
import integration.steps.then.`And the response should not be null`
import integration.steps.then.`Then the response should be`
import integration.steps.`when`.`When I send a GET request`
import integration.steps.`when`.`When I send a POST request`
import integration.steps.`when`.`with body`
import integration.steps.then.`whish contains`
import integration.steps.then.and
import integration.steps.given.`Given I have citizen`
import integration.steps.given.`Given I have constitution`
import integration.steps.given.`Given I have constitutions`
import integration.steps.given.`authenticated as`
import integration.steps.then.`And have property`
import integration.steps.then.`And the response should not be null`
import integration.steps.then.`Then the response should be`
import integration.steps.then.`whish contains`
import integration.steps.then.and
import io.ktor.http.HttpStatusCode.Companion.BadRequest
import io.ktor.http.HttpStatusCode.Companion.Created
import io.ktor.http.HttpStatusCode.Companion.OK
@@ -66,18 +66,20 @@ class `Constitution routes` : BaseTest() {
`Given I have citizen`("Henri", "Poincaré")
`When I send a POST request`("/constitutions") {
`authenticated as`("Henri", "Poincaré")
`with body`("""
{
"versionId":"15814bb6-8d90-4c6a-a456-c3939a8ec75e",
"title":"Hello world!",
"anonymous":true,
"titles":[
{
"name":"plop"
}
]
}
""")
`with body`(
"""
{
"versionId":"15814bb6-8d90-4c6a-a456-c3939a8ec75e",
"title":"Hello world!",
"anonymous":true,
"titles":[
{
"name":"plop"
}
]
}
"""
)
} `Then the response should be` Created and {
`And the response should not be null`()
`And have property`("$.versionId") `whish contains` "15814bb6-8d90-4c6a-a456-c3939a8ec75e"
@@ -92,19 +94,21 @@ class `Constitution routes` : BaseTest() {
`Given I have citizen`("Henri", "Poincaré")
`When I send a POST request`("/constitutions", Validate.ALL - Validate.REQUEST_BODY) {
`authenticated as`("Henri", "Poincaré")
`with body`("""
{
"versionId":"15814bb6-8d90-4c6a-a456-c3939a8ec75e",
"title":"Hello world!",
"anonymous":true,
"titles":[
{
"name":"plop",
"wrongField":0
}
]
}
""")
`with body`(
"""
{
"versionId":"15814bb6-8d90-4c6a-a456-c3939a8ec75e",
"title":"Hello world!",
"anonymous":true,
"titles":[
{
"name":"plop",
"wrongField":0
}
]
}
"""
)
} `Then the response should be` BadRequest
}
}