aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-10-08 12:33:20 +0300
committerGravatar Vitaly Takmazov2021-10-08 12:44:46 +0300
commit1f7c9e6c479da315381ba3469b271f9889836b33 (patch)
tree3f84918d5bf5f95b9d6333f1f9659902ac2a1955 /src/test/java/com
parent8ec250a4afd7110034aa37bc2527d07494ec2b07 (diff)
Add message editing and updating interval
* 3 days for message deletion * 15 minutes for editing
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index d19c76cb..faee1f53 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1306,7 +1306,17 @@ public class ServerTests {
.getNewMessage().get();
assertThat(editedComment.getText(), is("HEY, JOE"));
assertThat(editedComment.getUpdatedAt(), greaterThan(editedComment.getCreated()));
- messagesService.deleteMessage(ugnich.getUid(), original.getMid());
+ jdbcTemplate.update("UPDATE replies SET updated_at='1990-05-05 00:00:00' WHERE message_id=? AND reply_id=?", editedComment.getMid(), editedComment.getRid());
+ result = mockMvc
+ .perform(post("/api/update").with(httpBasic(freefdName, freefdPassword))
+ .param("mid", String.valueOf(comment.getNewMessage().get().getMid()))
+ .param("rid", String.valueOf(comment.getNewMessage().get().getRid())).param("body", "HEY, JOE AGAIN"))
+ .andExpect(status().isBadRequest()).andReturn();
+ jdbcTemplate.update("UPDATE messages_txt SET updated_at='1990-05-05 00:00:00' WHERE message_id=?", original.getMid());
+ assertThat(messagesService.deleteMessage(ugnich.getUid(), original.getMid()), is(false));
+ jdbcTemplate.update("UPDATE messages_txt SET updated_at=? WHERE message_id=?", Instant.now(), original.getMid());
+ assertThat(messagesService.deleteMessage(ugnich.getUid(), original.getMid()), is(true));
+
}
@Test