aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-20 19:36:37 +0300
committerGravatar Vitaly Takmazov2018-11-20 19:36:37 +0300
commit48b3585786f463592b67f825394ac62cdeaab787 (patch)
treefe12610d7cf26a0921c957fe124a8ccf4f906161 /src/test/java/com/juick/server
parentb6bb0dc8a3391442fad0124baa12799982cd6d8d (diff)
Fix tests
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 4345d607..0abce093 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -75,6 +75,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.util.DigestUtils;
import org.springframework.util.FileSystemUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@@ -438,6 +439,8 @@ public class ServerTests {
int mid = result.getNewMessage().get().getMid();
Message msg = messagesService.getMessage(mid).get();
tagService.createTag("ั‚ะตัั‚");
+ ClassPathResource defaultAvatar = new ClassPathResource("static/av-96.png");
+ String hash = DigestUtils.md5DigestAsHex(IOUtils.toByteArray(defaultAvatar.getInputStream()));
mockMvc.perform(
get("/api/home")
.with(httpBasic(ugnichName, ugnichPassword)))
@@ -451,7 +454,8 @@ public class ServerTests {
is(String.format("https://i.juick.com/p/%d.png", msg.getMid()))))
.andExpect(jsonPath("$[0].attachment.small.url",
is(String.format("https://i.juick.com/photos-512/%d.png", msg.getMid()))))
- .andExpect(jsonPath("$[0].user.avatar").doesNotExist());
+ .andExpect(jsonPath("$[0].user.avatar",
+ is(String.format("http://localhost:8080/av-96-%s.png", hash))));
}
@Test
@@ -1437,9 +1441,11 @@ public class ServerTests {
}
@Test
public void userProfileAndBlogShouldBeExposedAsActivityStream() throws Exception {
+ ClassPathResource defaultAvatar = new ClassPathResource("static/av-96.png");
+ String hash = DigestUtils.md5DigestAsHex(IOUtils.toByteArray(defaultAvatar.getInputStream()));
mockMvc.perform(get("/u/ugnich").accept(Context.LD_JSON_MEDIA_TYPE))
.andExpect(status().isOk())
- .andExpect(jsonPath("$.icon.url", is("http://localhost:8080/i/a/1.png")))
+ .andExpect(jsonPath("$.icon.url", is(String.format("http://localhost:8080/av-96-%s.png", hash))))
.andExpect(jsonPath("$.publicKey.publicKeyPem", is(keystoreManager.getPublicKeyPem())));
jdbcTemplate.execute("DELETE FROM messages");
List<Integer> mids = IteratorUtils.toList(IntStream.rangeClosed(1, 30)