Add test 404 for GetArticle route

This commit is contained in:
2021-04-09 01:40:22 +02:00
parent fb7b07340a
commit 875d0bfffa
3 changed files with 35 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ import integration.steps.then.`which contains`
import integration.steps.then.and
import io.ktor.http.HttpStatusCode.Companion.BadRequest
import io.ktor.http.HttpStatusCode.Companion.Forbidden
import io.ktor.http.HttpStatusCode.Companion.NotFound
import io.ktor.http.HttpStatusCode.Companion.OK
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Tags
@@ -82,6 +83,17 @@ class `Article routes` : BaseTest() {
}
}
@Test
fun `I cannot get article with id doesn't exist`() {
withIntegrationApplication {
`When I send a GET request`("/articles/635fe2e8-2dbc-4c80-b306-101d38a4ab23") `Then the response should be` NotFound and {
`And the response should not be null`()
`And the response should contain`("$.title", "Article 635fe2e8-2dbc-4c80-b306-101d38a4ab23 not found")
`And the response should contain`("$.statusCode", 404)
}
}
}
@Test
@Tag("BadRequest")
fun `I cannot get article by id with wrong id format`() {