diff options
author | Vitaly Takmazov | 2018-07-15 11:43:36 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-07-15 11:43:36 +0300 |
commit | 3870fd009e13d728a343d2ebe79c4f6cd113f2ab (patch) | |
tree | 8718ba7d045a9ac7a337244373fbbd1af76b4966 /juick-server/src/test | |
parent | 3936bb230a856c12a0afbab3fb1baa331beee337 (diff) |
Api: read and readers in /me
Diffstat (limited to 'juick-server/src/test')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 16 |
1 files changed, 13 insertions, 3 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 3fc56af7..3ac4ff82 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 @@ -230,6 +230,8 @@ public class ServerTests { assertThat(telegramService.getTelegramIdentifiers(subscribers2).size(), equalTo(0)); tagService.blacklistTag(freefd, yoTag); assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), mid).size(), equalTo(1)); + subscriptionService.unSubscribeUser(freefd, ugnich); + assertThat(subscriptionService.getSubscribedUsers(ugnich.getUid(), mid).size(), equalTo(0)); } @Test public void pmTests() { @@ -1042,11 +1044,19 @@ public class ServerTests { assertThat(attachment.getWidth(), is(1)); } @Test - public void meContainsHash() throws Exception { + public void meContainsAllInfo() throws Exception { + jdbcTemplate.update("DELETE FROM subscr_users"); + assertThat(userService.getUserReaders(ugnich.getUid()).size(), is(0)); + assertThat(userService.getUserFriends(ugnich.getUid()).size(), is(0)); + commandsManager.processCommand(freefd, "S @ugnich", emptyUri); + commandsManager.processCommand(ugnich, "S @freefd", emptyUri); + assertThat(userService.getUserReaders(ugnich.getUid()).size(), is(1)); String hash = userService.getHashByUID(ugnich.getUid()); mockMvc.perform(get("/me") - .with(httpBasic(ugnichName, ugnichPassword))) - .andExpect(jsonPath("$.hash", is(hash))); + .with(httpBasic(ugnichName, ugnichPassword))) + .andExpect(jsonPath("$.hash", is(hash))) + .andExpect(jsonPath("$.readers.length()", is(1))) + .andExpect(jsonPath("$.read.length()", is(1))); } @Test public void feedsShouldNotContainBannedUsers() throws Exception { |