Add validation on route FindCitizens

This commit is contained in:
2021-04-08 22:25:43 +02:00
parent e473e62068
commit 13cdaaf01a
6 changed files with 65 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ class `Citizen routes` : BaseTest() {
fun `I can get Citizens information`() {
withIntegrationApplication {
`Given I have citizen`("Jean", "Perrin", id = "5267a5c6-af42-4a02-aa2b-6b71d2e43973")
`When I send a GET request`("/citizens") {
`When I send a GET request`("/citizens?page=1&limit=5&sort=createdAt") {
`authenticated as`("Jean", "Perrin")
} `Then the response should be` OK and {
`And the response should not be null`()
@@ -34,6 +34,19 @@ class `Citizen routes` : BaseTest() {
}
}
@Test
@Tag("BadRequest")
fun `I cannot get Citizens information with wrong request`() {
withIntegrationApplication {
`Given I have citizen`("Jean", "Perrin", id = "5267a5c6-af42-4a02-aa2b-6b71d2e43973")
`When I send a GET request`("/citizens?page=1&limit=5&sort=created_at", Validate.ALL - Validate.REQUEST_PARAM) {
`authenticated as`("Jean", "Perrin")
} `Then the response should be` BadRequest and {
`And the response should not be null`()
}
}
}
@Test
fun `I can get specific Citizen information`() {
withIntegrationApplication {