diff options
Diffstat (limited to 'juick-server/src/test/java')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 4d93470d..2d55b047 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -29,6 +29,7 @@ import com.jayway.jsonpath.JsonPath; import com.juick.*; import com.juick.model.AnonymousUser; import com.juick.model.CommandResult; +import com.juick.model.PrivateChats; import com.juick.model.TagStats; import com.juick.server.*; import com.juick.server.api.activity.model.Context; @@ -1730,4 +1731,19 @@ public class ServerTests { .andExpect(status().isOk()).andReturn(); String xrd = result.getResponse().getContentAsString(); } + @Test + public void pms() throws Exception { + jdbcTemplate.execute("DELETE FROM pm"); + jdbcTemplate.execute("DELETE FROM pm_streams"); + CommandResult res = commandsManager.processCommand(ugnich, "@freefd DICK", emptyUri); + assertThat(res.getNewMessage(), is(Optional.empty())); + assertThat(res.getText(), is("Private message sent")); + MvcResult result = mockMvc.perform(get("/api/groups_pms") + .with(httpBasic(freefdName, freefdPassword))) + .andExpect(status().isOk()) + .andReturn(); + PrivateChats chats = jsonMapper.readValue(result.getResponse().getContentAsString(), PrivateChats.class); + assertThat(chats.getUsers().size(), is(1)); + assertThat(chats.getUsers().get(0).getUnreadCount(), is(1)); + } } |