diff options
author | Vitaly Takmazov | 2019-04-09 23:11:18 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-04-09 23:11:34 +0300 |
commit | 18094466ae8aae8a5c2e74fa18ba3f49d2c9fabf (patch) | |
tree | 06419aa1571be1a6f40d3da33755b81bd5e30431 /src/test/java | |
parent | 0880615c6211f7e0f3d54f3e9247772b69b09267 (diff) |
Fix likes counter while fixing tests on mysql
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 0039d378..32e9929e 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -258,7 +258,6 @@ public class ServerTests { freefd = userService.getUserByUID(freefdId).orElseThrow(IllegalStateException::new); int juickId = userService.createUser(juickName, juickPassword); juick = userService.getUserByUID(juickId).orElseThrow(IllegalStateException::new); - subscriptionService.subscribeUser(freefd, ugnich); webClient.getOptions().setJavaScriptEnabled(false); isSetUp = true; } @@ -272,6 +271,9 @@ public class ServerTests { } @Test public void getMyFeed() { + jdbcTemplate.execute("DELETE FROM telegram"); + jdbcTemplate.execute("DELETE FROM subscr_users"); + subscriptionService.subscribeUser(freefd, ugnich); int mid0 = messagesService.createMessage(ugnich.getUid(), "test", null, null); int mid2 = messagesService.createMessage(ugnich.getUid(), "test2", null, null); List<Integer> freefdFeed = messagesService.getMyFeed(freefd.getUid(), 0, false); @@ -631,10 +633,12 @@ public class ServerTests { .with(httpBasic(juickName, juickPassword))) .andExpect(status().isOk()) .andReturn(); - List<User> user = jsonMapper.readValue(result.getResponse().getContentAsString(), + List<User> users = jsonMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<User>>() { }); - assertThat(user.get(0).getTokens().get(0).getToken(), equalTo(token)); + assertThat(users.size(), is(1)); + assertThat(users.get(0).getTokens().size(), is(1)); + assertThat(users.get(0).getTokens().get(0).getToken(), equalTo(token)); } @Test public void tg2juickLinks() { @@ -991,7 +995,7 @@ public class ServerTests { .stream().noneMatch(m -> m.getTags().contains(banned))); assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getMyFeed(freefd.getUid(), 0, true)) .stream().noneMatch(m -> m.getTags().contains(banned))); - int newUid = userService.createUser("newUser", "12345"); + int newUid = userService.createUser("newUser1", "12345"); int newMid = messagesService.createMessage(newUid, "people", null, Collections.singletonList(banned)); messagesService.recommendMessage(newMid, ugnich.getUid()); assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getMyFeed(freefd.getUid(), 0, true)) @@ -1362,6 +1366,7 @@ public class ServerTests { } @Test public void bannedUserShouldBeShadowedFromRecommendationsList() throws IOException { + jdbcTemplate.execute("DELETE FROM bl_users"); int ermineId = userService.createUser("ermine", "secret"); int monstreekId = userService.createUser("monstreek", "secret"); int pogoId = userService.createUser("pogo", "secret"); @@ -1829,6 +1834,7 @@ public class ServerTests { public void seenTests() { Instant now = Instant.now(); int newUserUid = userService.createUser("newuser", "assword"); + assertThat(newUserUid, greaterThanOrEqualTo(0)); assertThat(userService.getUserByUID(newUserUid).get().getSeen(), is(nullValue())); messagesService.createMessage(newUserUid, "YO", "", null); assertThat(userService.getUserByUID(newUserUid).get().getSeen(), greaterThanOrEqualTo(now)); |