Test openapi schema requestBody

This commit is contained in:
2021-03-15 02:01:39 +01:00
parent 9c88adbabd
commit 97b07fb424
12 changed files with 155 additions and 87 deletions

View File

@@ -6,6 +6,7 @@ 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 article created by workgroup`
@@ -14,7 +15,6 @@ import integration.steps.given.`Given I have articles`
import integration.steps.given.`Given I have citizen`
import integration.steps.given.`Given I have workgroup`
import integration.steps.given.`authenticated as`
import integration.steps.then.`And schema must be valid`
import integration.steps.then.`And the response should contain list`
import integration.steps.then.`And the response should not contain`
import io.ktor.http.HttpStatusCode.Companion.OK
@@ -37,7 +37,6 @@ class `Article routes` : BaseTest() {
`And the response should contain pattern`("$.result[2].createdBy.name.firstName", "firstName.+")
`And the response should not contain`("$.result[3]")
`And the response should contain list`("$.result", 3, 3)
`And schema must be valid`()
}
}
}
@@ -52,7 +51,6 @@ class `Article routes` : BaseTest() {
`And the response should not be null`()
`And have property`("$.total") `whish contains` 1
`And have property`("$.result[0]workgroup.name") `whish contains` "Les papy"
`And schema must be valid`()
}
}
}
@@ -64,7 +62,6 @@ class `Article routes` : BaseTest() {
`When I send a GET request`("/articles/65cda9f3-8991-4420-8d41-1da9da72c9bb") `Then the response should be` OK and {
`And the response should not be null`()
`And have property`("$.id") `whish contains` "65cda9f3-8991-4420-8d41-1da9da72c9bb"
`And schema must be valid`()
}
}
}
@@ -77,7 +74,6 @@ class `Article routes` : BaseTest() {
`And the response should not be null`()
`And have property`("$.total") `whish contains` 1
`And have property`("$.result[0].id") `whish contains` "13e6091c-8fed-4600-b079-a97a6b7a9800"
`And schema must be valid`()
}
}
}
@@ -88,7 +84,7 @@ class `Article routes` : BaseTest() {
`Given I have citizen`("John", "Doe")
`When I send a POST request`("/articles") {
`authenticated as`("John", "Doe")
"""
`with body`("""
{
"versionId": "09c418b6-63ba-448b-b38b-502b41cd500e",
"title": "title2",
@@ -99,11 +95,10 @@ class `Article routes` : BaseTest() {
"green"
]
}
"""
""")
} `Then the response should be` OK and {
`And the response should not be null`()
`And have property`("$.versionId") `whish contains` "09c418b6-63ba-448b-b38b-502b41cd500e"
`And schema must be valid`()
}
}
}