Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
don-bigdad committed Jan 26, 2024
1 parent 8364d1d commit aa873a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.springframework.http.MediaType;
import org.springframework.jdbc.datasource.init.ScriptUtils;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
Expand Down Expand Up @@ -80,8 +79,6 @@ static void tearDown(DataSource dataSource) {

@Test
@DisplayName("Create a new book")
@Sql(scripts = "classpath:database/books/clear-books-db.sql",
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@WithMockUser(username = "admin", roles = {"ADMIN"})
void createBook_ValidRequestDto_Ok() throws Exception {
CreateBookRequestDto createBookRequestDto = new CreateBookRequestDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,7 @@ void deleteCategoryById_NoPermission_NotOk() throws Exception {
@Test
@DisplayName("Update category by id")
@WithMockUser(username = "admin", roles = {"ADMIN","USER"})
void updateBookById_ValidId_Ok() throws Exception {
MvcResult result = mockMvc.perform(get("/category/2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn();
CategoryDto dto = objectMapper.readValue(result.getResponse()
.getContentAsString(), CategoryDto.class);
assertEquals("Category 2", dto.name());

void updateCategoryById_ValidId_Ok() throws Exception {
CategoryRequestDto updateRequest = new CategoryRequestDto(
"Updated name",
"Updated description"
Expand Down

0 comments on commit aa873a0

Please sign in to comment.