Skip to content

Commit

Permalink
test: 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjae6751 committed Sep 19, 2024
1 parent 119da1d commit 2690bcb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/java/in/koreatech/koin/acceptance/KeywordApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,35 @@ void setup() {
clear();
setup();
}

@Test
@Transactional
void 권한이_없으면_공지사항_알림_요청_실패() throws Exception {

Board board = boardFixture.자유게시판();

List<Integer> articleIds = new ArrayList<>();

for (int i = 1; i <= 5; i++) {
Article article = articleFixture.자유글_3("수강신청" + i, board, i);
articleIds.add(article.getId());
}

keywordFixture.키워드1("수강신청6", 준호_학생.getUser());

mockMvc.perform(
post("/articles/keyword/notification")
.content("""
{
"update_notification": %s
}
""".formatted(articleIds.toString()))
.header("Authorization", "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON)
)
.andExpect(status().isForbidden());
forceVerify(() -> verify(articleKeywordEventListener, never()).onKeywordRequest(any()));
clear();
setup();
}
}

0 comments on commit 2690bcb

Please sign in to comment.