aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-16 15:20:58 +0300
committerGravatar Vitaly Takmazov2018-04-16 15:24:41 +0300
commita1703a67b166fd2e1616acb4e9ba0cdb218b521c (patch)
tree8d19695792d73faa481c24b1a6c0237c9ddaad47 /juick-server/src/test/java/com
parent350f6942078e67b15e160ecffc913ba0cef624be (diff)
server: mark messages read from email notifications
Diffstat (limited to 'juick-server/src/test/java/com')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java10
1 files changed, 9 insertions, 1 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 046e0e7d..71c42b6c 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
@@ -31,6 +31,7 @@ import com.juick.server.util.HttpUtils;
import com.juick.service.*;
import com.juick.util.DateFormattersHolder;
import com.juick.util.MessageUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
import org.junit.Assert;
@@ -754,7 +755,7 @@ public class ServerTests {
telegramBotManager.processUpdate("{\"message\":{\"chat\":{\"id\":1},\"text\":\"yo\",\"from\":{\"id\":1,\"username\":\"teleugnich\"}}}");
}
@Test
- public void lastReadTests() {
+ public void lastReadTests() throws Exception {
int mid = messagesService.createMessage(ugnich.getUid(), "to be watched", null, null);
subscriptionService.subscribeMessage(messagesService.getMessage(mid), ugnich);
messagesService.createReply(mid, 0, freefd, "new reply", null);
@@ -769,5 +770,12 @@ public class ServerTests {
assertThat(messagesService.getUnread(ugnich).size(), is(0));
messagesService.setLastReadComment(ugnich, mid, 0);
assertThat(lastRead.apply(ugnich, mid), is(1));
+ String ugnichHash = userService.getHashByUID(ugnich.getUid());
+ int freefdrid = messagesService.createReply(mid, 0, freefd, "again", null);
+ mockMvc.perform(get(String.format("/thread/mark_read/%d-%d.gif?hash=%s", mid, freefdrid, ugnichHash)))
+ .andExpect(status().isOk())
+ .andExpect(content().bytes(IOUtils.toByteArray(
+ Objects.requireNonNull(getClass().getClassLoader().getResource("Transparent.gif")))));
+ assertThat(lastRead.apply(ugnich, mid), is(freefdrid));
}
}