From c04eb6d3769f5a52372b560160147f7acc7079e8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 9 Feb 2018 14:55:23 +0300 Subject: server: add some tests --- .../src/test/java/com/juick/server/tests/MessagesTests.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'juick-server/src/test/java') diff --git a/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java b/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java index 53267a0f..37973bf5 100644 --- a/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/MessagesTests.java @@ -295,6 +295,13 @@ public class MessagesTests extends AbstractJUnit4SpringContextTests { .content(jsonMapper.writeValueAsBytes(tokens))).andExpect(status().isOk()); } @Test + public void notificationsSettingsAllowedOnlyForServiceUser() throws Exception { + mockMvc.perform(get("/notifications").with(httpBasic(juickName, juickPassword)) + .param("mid", "1").param("uid", String.valueOf(ugnich.getUid()))).andExpect(status().isOk()); + mockMvc.perform(get("/notifications") + .param("mid", "1").param("uid", String.valueOf(ugnich.getUid()))).andExpect(status().isUnauthorized()); + } + @Test public void topTest() throws Exception { int topmid = messagesService.createMessage(ugnich.getUid(), "top message", null, null); IntStream.rangeClosed(6, 12).forEach(i -> { -- cgit v1.2.3