Skip to content

Commit

Permalink
feat: add unit test to cover that CRSF filter is working
Browse files Browse the repository at this point in the history
  • Loading branch information
tkuzynow committed Apr 17, 2024
1 parent 7a9db36 commit 6d5b84d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ void sendMailsShouldRespondWithOkWhenEmailListIsEmpty() throws Exception {
.andExpect(status().isOk());
}

@Test
void sendMailsShouldRespondWithAccessDeniedWhenCrsfTokenIsNotGiven() throws Exception {
givenAnEmptyEmailList();

mockMvc
.perform(
post("/mails/send")
.cookie(CSRF_COOKIE)
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(mailsDTO))
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isForbidden());
}

@Test
void sendMailsShouldSendEmailAndRenderDataWithDefaultLanguageWhenLanguageNotGiven()
throws Exception {
Expand Down

0 comments on commit 6d5b84d

Please sign in to comment.