From 2690bcbaaffc6341eb3fceec5afe4a96da1218fc Mon Sep 17 00:00:00 2001 From: seongjae6751 Date: Thu, 19 Sep 2024 13:31:30 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../koin/acceptance/KeywordApiTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/test/java/in/koreatech/koin/acceptance/KeywordApiTest.java b/src/test/java/in/koreatech/koin/acceptance/KeywordApiTest.java index f6f747658..01e26f93f 100644 --- a/src/test/java/in/koreatech/koin/acceptance/KeywordApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/KeywordApiTest.java @@ -275,4 +275,35 @@ void setup() { clear(); setup(); } + + @Test + @Transactional + void 권한이_없으면_공지사항_알림_요청_실패() throws Exception { + + Board board = boardFixture.자유게시판(); + + List 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(); + } }