fix tests

This commit is contained in:
Gauthier Roebroeck 2019-11-19 14:54:27 +08:00
parent 5b252ed13a
commit ff30013395
2 changed files with 15 additions and 2 deletions

View file

@ -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)
}

View file

@ -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`() {