fix: integration test and ascii documentation

This commit is contained in:
Marcel Haag 2022-08-19 13:10:32 +02:00 committed by mhg
parent d814a87033
commit ecaaeea079
3 changed files with 31 additions and 16 deletions

View File

@ -130,7 +130,10 @@ class ProjectService(private val projectRepository: ProjectRepository) {
* @throws [TransactionInterruptedException] if the [Project] could not be updated
* @return updated list of [ProjectPentest]s
*/
fun updateProjectTestingProgress(projectId: String, projectPentests: ProjectPentest)/*: Mono<List<ProjectPentest>>*/ {
fun updateProjectTestingProgress(
projectId: String,
projectPentests: ProjectPentest
)/*: Mono<List<ProjectPentest>>*/ {
// ToDo: update Project Entity with progress
}
}

View File

@ -81,10 +81,10 @@ class PentestControllerDocumentationTest : BaseDocumentationIntTest() {
.description("The reference number of the requested pentest according to the current OWASP Testing Guide"),
PayloadDocumentation.fieldWithPath("[].status").type(JsonFieldType.STRING)
.description("The status of the requested pentest"),
PayloadDocumentation.fieldWithPath("[].findingIds").type(JsonFieldType.STRING)
.description("The ids of the findings in the requested pentest"),
PayloadDocumentation.fieldWithPath("[].commentIds").type(JsonFieldType.STRING)
.description("The ids of the comments of the requested pentest")
PayloadDocumentation.fieldWithPath("[].findingIds").type(JsonFieldType.ARRAY)
.description("List of ids of the findings in the requested pentest"),
PayloadDocumentation.fieldWithPath("[].commentIds").type(JsonFieldType.ARRAY)
.description("List of ids of the comments of the requested pentest")
)
)
)

View File

@ -74,7 +74,9 @@ class ProjectControllerDocumentationTest : BaseDocumentationIntTest() {
PayloadDocumentation.fieldWithPath("[].tester").type(JsonFieldType.STRING)
.description("The user that is assigned as a tester in the project"),
PayloadDocumentation.fieldWithPath("[].createdBy").type(JsonFieldType.STRING)
.description("The id of the user that created the project")
.description("The id of the user that created the project"),
PayloadDocumentation.fieldWithPath("[].testingProgress").type(JsonFieldType.NUMBER)
.description("The progress of the project from completed pentests")
)
)
)
@ -139,7 +141,9 @@ class ProjectControllerDocumentationTest : BaseDocumentationIntTest() {
PayloadDocumentation.fieldWithPath("tester").type(JsonFieldType.STRING)
.description("The user that is assigned as a tester in the project"),
PayloadDocumentation.fieldWithPath("createdBy").type(JsonFieldType.STRING)
.description("The id of the user that created the project")
.description("The id of the user that created the project"),
PayloadDocumentation.fieldWithPath("testingProgress").type(JsonFieldType.NUMBER)
.description("The progress of the project from completed pentests")
)
)
)
@ -231,11 +235,11 @@ class ProjectControllerDocumentationTest : BaseDocumentationIntTest() {
fun updateProject() {
webTestClient.patch().uri("/projects/${projectUpdate.id}")
.header("Authorization", "Bearer $tokenAdmin")
.body(Mono.just(projectUpdate), ProjectRequestBody::class.java)
.body(Mono.just(projectUpdateRequest), ProjectRequestBody::class.java)
.exchange()
.expectStatus().isAccepted
.expectHeader().valueEquals("Application-Name", "SecurityC4PO")
.expectBody().json(Json.write(projectUpdate))
.expectBody().json(Json.write(projectUpdate.toProjectResponseBody()))
.consumeWith(
WebTestClientRestDocumentation.document(
"{methodName}",
@ -259,12 +263,20 @@ class ProjectControllerDocumentationTest : BaseDocumentationIntTest() {
PayloadDocumentation.fieldWithPath("tester").type(JsonFieldType.STRING)
.description("The updated user that is assigned as a tester in the project"),
PayloadDocumentation.fieldWithPath("createdBy").type(JsonFieldType.STRING)
.description("The id of the user that created the project")
.description("The id of the user that created the project"),
PayloadDocumentation.fieldWithPath("testingProgress").type(JsonFieldType.NUMBER)
.description("The progress of the project from completed pentests")
)
)
)
}
val projectUpdateRequest = ProjectRequestBody(
client = "Novatec_updated",
title = "log4j Pentest_updated",
tester = "Stipe_updated"
)
val projectUpdate = Project(
id = "4f6567a8-76fd-487b-8602-f82d0ca4d1f9",
client = "Novatec_updated",