Skip to content
Snippets Groups Projects
Commit dcc78c9b authored by Dominika Zemanovičová's avatar Dominika Zemanovičová
Browse files

Test delete user

parent 2bb0e4c8
No related branches found
No related tags found
2 merge requests!14Language school user tests,!13Language school user
......@@ -117,6 +117,20 @@ class UserControllerTest {
.andExpect(jsonPath("$.id").value(id));
}
@Test
void deleteUser() throws Exception {
String response = mockMvc.perform(post("/users")
.content(asJsonString(USER_TO_CREATE))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
String id = objectMapper.readValue(response, UserDto.class).getId();
mockMvc.perform(delete("/users/{id}", id)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}
private static String asJsonString(final Object obj) throws JsonProcessingException {
return new ObjectMapper().writeValueAsString(obj);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment