diff options
author | 2018-11-28 14:58:45 +0300 | |
---|---|---|
committer | 2018-11-28 14:58:45 +0300 | |
commit | 7b97f3df5a5c31c5d85ee71c902fa9bf979ffc54 (patch) | |
tree | d52c9ee2bf5066b84f348a1f4aeb27cbcf5e0678 /src/test/java/com | |
parent | 0fea66317d608cb0f67bb92695a40d100d504c8d (diff) |
Fix EditOrReply command flow
Diffstat (limited to 'src/test/java/com')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 4b0de65d..7c038058 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -798,9 +798,8 @@ public class ServerTests { Timestamp lastreply = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid()); assertThat(lastreply.toInstant(), equalTo(reply.getTimestamp())); assertEquals("should be reply to second comment", 2, reply.getReplyto()); - assertEquals("tags should NOT be updated", "It is not your message", - commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri) - .getText()); + assertThat(commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri) + .getText(), startsWith("Reply posted")); assertEquals("tags should be updated", "Tags are updated", commandsManager.processCommand(user, "#" + mid + " *there", emptyUri).getText()); assertEquals("number of tags should match", 2, @@ -1809,4 +1808,14 @@ public class ServerTests { com.juick.User testuser = jsonMapper.readValue(result.getResponse().getContentAsString(), User.class); assertThat(testuser.getName(), is("testuser")); } + @Test + public void doNotAllowRepliesToNonExistingReplyAndNotAllowToEditTagsOfComment() throws Exception { + assertThat(commandsManager.processCommand(ugnich, "#23213213/2 BAD COMMENT", emptyUri).getText(), is("Message not found")); + Message msg = commandsManager.processCommand(ugnich, "YO", emptyUri).getNewMessage().get(); + assertThat(commandsManager.processCommand(ugnich, String.format("#%d/1 BAD COMMENT", msg.getMid()), emptyUri).getText(), is("Reply not found")); + CommandResult result = commandsManager.processCommand(freefd, + String.format("#%d *GOOD *COMMENT", msg.getMid()), emptyUri); + Message reply = result.getNewMessage().get(); + assertThat(commandsManager.processCommand(ugnich, String.format("#%d/%d *GOOD *BAD", reply.getMid(), reply.getRid()), emptyUri).getText(), startsWith("Reply posted")); + } } |