Add validation on route GetOneArticle
This commit is contained in:
@@ -31,7 +31,7 @@ val converters: ConverterDeclaration = {
|
|||||||
invalidParams = listOf(
|
invalidParams = listOf(
|
||||||
InvalidParam(
|
InvalidParam(
|
||||||
"ID",
|
"ID",
|
||||||
"ID must be UUID"
|
"must be UUID"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -147,6 +147,12 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ArticleResponse'
|
$ref: '#/components/schemas/ArticleResponse'
|
||||||
|
400:
|
||||||
|
description: BadReqest
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/400'
|
||||||
/articles/{article}/versions:
|
/articles/{article}/versions:
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/article'
|
- $ref: '#/components/parameters/article'
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class `Article routes` : BaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Tag("Validation")
|
@Tag("BadRequest")
|
||||||
fun `I cannot get article list`() {
|
fun `I cannot get article list`() {
|
||||||
withIntegrationApplication {
|
withIntegrationApplication {
|
||||||
`Given I have articles`(3)
|
`Given I have articles`(3)
|
||||||
@@ -82,6 +82,19 @@ class `Article routes` : BaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Tag("BadRequest")
|
||||||
|
fun `I cannot get article by id with wrong id format`() {
|
||||||
|
withIntegrationApplication {
|
||||||
|
`Given I have article`(id = "65cda9f3-8991-4420-8d41-1da9da72c9bb")
|
||||||
|
`When I send a GET request`("/articles/abcd") `Then the response should be` BadRequest and {
|
||||||
|
`And the response should not be null`()
|
||||||
|
`And the response should contain`("$.invalidParams[0].name", "ID")
|
||||||
|
`And the response should contain`("$.invalidParams[0].reason", "must be UUID")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `I can get versions of article by the id`() {
|
fun `I can get versions of article by the id`() {
|
||||||
withIntegrationApplication {
|
withIntegrationApplication {
|
||||||
@@ -95,7 +108,7 @@ class `Article routes` : BaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Tag("Validation")
|
@Tag("BadRequest")
|
||||||
fun `I cannot get versions of article by the id with wrong id`() {
|
fun `I cannot get versions of article by the id with wrong id`() {
|
||||||
withIntegrationApplication {
|
withIntegrationApplication {
|
||||||
`Given I have article`(id = "13e6091c-8fed-4600-b079-a97a6b7a9800")
|
`Given I have article`(id = "13e6091c-8fed-4600-b079-a97a6b7a9800")
|
||||||
@@ -108,7 +121,7 @@ class `Article routes` : BaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Tag("Validation")
|
@Tag("BadRequest")
|
||||||
fun `I cannot get versions of article by the id with wrong request`() {
|
fun `I cannot get versions of article by the id with wrong request`() {
|
||||||
withIntegrationApplication {
|
withIntegrationApplication {
|
||||||
`Given I have article`(id = "13e6091c-8fed-4600-b079-a97a6b7a9800")
|
`Given I have article`(id = "13e6091c-8fed-4600-b079-a97a6b7a9800")
|
||||||
|
|||||||
Reference in New Issue
Block a user