diff --git a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt index dcfd6583..413baed9 100644 --- a/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt +++ b/src/test/kotlin/pt/up/fe/ni/website/backend/controller/EventControllerTest.kt @@ -835,6 +835,10 @@ internal class EventControllerTest @Autowired constructor( repository.save(testEvent) } + private val parameters = listOf( + parameterWithName("idEvent").description("The id of the event being targeted") + ) + @Test fun `should add an image`() { val expectedImagePath = "${uploadConfigProperties.staticServe}/events/gallery/${testEvent.title}-$uuid.jpeg" @@ -859,6 +863,14 @@ internal class EventControllerTest @Autowired constructor( jsonPath("$.slug").value(testEvent.slug), jsonPath("$.image").value(testEvent.image) ) + /* + .andDocument( + documentation, + "Adds an image to the gallery of the selected event", + "This endpoint adds an image to the gallery of an event, returning the event's updated data.", + urlParameters = parameters + ) + */ } @Test @@ -874,7 +886,7 @@ internal class EventControllerTest @Autowired constructor( content().contentType(MediaType.APPLICATION_JSON), jsonPath("$.errors.length()").value(1), jsonPath("$.errors[0].message").value("activity not found with id $nonexistentID") - ) + ).andDocumentErrorResponse(documentation) } @Test @@ -888,7 +900,7 @@ internal class EventControllerTest @Autowired constructor( content().contentType(MediaType.APPLICATION_JSON), jsonPath("$.errors.length()").value(1), jsonPath("$.errors[0].message").value("invalid image type (png, jpg, jpeg or webp)") - ) + ).andDocumentErrorResponse(documentation) } } @@ -920,6 +932,10 @@ internal class EventControllerTest @Autowired constructor( repository.save(testEvent) } + private val parameters = listOf( + parameterWithName("idEvent").description("The id of the event being targeted") + ) + @Test fun `should remove an image`() { mockMvc.multipartBuilder("/events/${testEvent.id}/gallery") @@ -941,6 +957,14 @@ internal class EventControllerTest @Autowired constructor( jsonPath("$.slug").value(testEvent.slug), jsonPath("$.image").value(testEvent.image) ) + /* + .andDocument( + documentation, + "Removes an image from the gallery of a selected event", + "This endpoint removes an image to the gallery of an event, returning the event's updated data.", + urlParameters = parameters + ) + */ } @Test @@ -956,7 +980,7 @@ internal class EventControllerTest @Autowired constructor( content().contentType(MediaType.APPLICATION_JSON), jsonPath("$.errors.length()").value(1), jsonPath("$.errors[0].message").value("activity not found with id $nonexistentID") - ) + ).andDocumentErrorResponse(documentation) } @Test @@ -972,7 +996,7 @@ internal class EventControllerTest @Autowired constructor( content().contentType(MediaType.APPLICATION_JSON), jsonPath("$.errors.length()").value(1), jsonPath("$.errors[0].message").value("file not found with name $wrongImageUrl") - ) + ).andDocumentErrorResponse(documentation) } }