aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-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