aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-18 12:45:58 +0300
committerGravatar Vitaly Takmazov2018-10-18 12:45:58 +0300
commita1f9fe5ea28ec28d7cda704d8ef79ca2bd890195 (patch)
tree04475b630931d61d1fff0b9f455ad51bfc09c0fa /juick-server/src/test/java
parent4c3dbf0fbe903cd9d4b6c54a20958e56e1a77a4d (diff)
last message in pm groups
Diffstat (limited to 'juick-server/src/test/java')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java16
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));
+ }
}