From ff300133957a6d0671a7bdb68ddc812777e592f9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Tue, 19 Nov 2019 14:54:27 +0800 Subject: [PATCH] fix tests --- .../komga/interfaces/web/rest/SeriesController.kt | 4 ++-- .../interfaces/web/rest/SeriesControllerTest.kt | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/web/rest/SeriesController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/web/rest/SeriesController.kt index b1f52cfa..7e60e127 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/web/rest/SeriesController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/web/rest/SeriesController.kt @@ -133,7 +133,7 @@ class SeriesController( ResponseEntity.ok() .cacheControl(thumbnailsCache) .body(thumbnail) - } else throw ResponseStatusException(HttpStatus.NO_CONTENT) + } else throw ResponseStatusException(HttpStatus.NOT_FOUND) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @GetMapping("{seriesId}/books") @@ -182,7 +182,7 @@ class SeriesController( ResponseEntity.ok() .cacheControl(thumbnailsCache) .body(it.metadata.thumbnail) - } else throw ResponseStatusException(HttpStatus.NO_CONTENT) + } else throw ResponseStatusException(HttpStatus.NOT_FOUND) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) } diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/web/rest/SeriesControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/web/rest/SeriesControllerTest.kt index bdd46767..54f8dbe5 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/web/rest/SeriesControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/web/rest/SeriesControllerTest.kt @@ -265,6 +265,19 @@ class SeriesControllerTest( @Nested inner class BookMetadataNotReady { + @Test + @WithMockCustomUser + fun `given book without thumbnail when getting series thumbnail then returns not found`() { + val series = makeSeries( + name = "series", + books = listOf(makeBook("1")) + ).also { it.library = library } + seriesRepository.save(series) + + mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/series/${series.id}/thumbnail")) + .andExpect(MockMvcResultMatchers.status().isNotFound) + } + @Test @WithMockCustomUser fun `given book without thumbnail when getting book thumbnail then returns not found`() {