aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java11
1 files changed, 9 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 b914aed0..01aa298b 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -221,10 +221,16 @@ public class ServerTests {
FileSystemUtils.deleteRecursively(Paths.get(imgDir, "photos-1024"));
FileSystemUtils.deleteRecursively(Paths.get(imgDir, "photos-512"));
FileSystemUtils.deleteRecursively(Paths.get(imgDir, "ps"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "a"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "ao"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "as"));
Files.createDirectory(Paths.get(imgDir, "p"));
Files.createDirectory(Paths.get(imgDir, "photos-1024"));
Files.createDirectory(Paths.get(imgDir, "photos-512"));
Files.createDirectory(Paths.get(imgDir, "ps"));
+ Files.createDirectory(Paths.get(imgDir, "a"));
+ Files.createDirectory(Paths.get(imgDir, "ao"));
+ Files.createDirectory(Paths.get(imgDir, "as"));
if (!isSetUp) {
ugnichName = "ugnich";
ugnichPassword = "secret";
@@ -1868,14 +1874,15 @@ public class ServerTests {
String hash = DigestUtils.md5DigestAsHex(IOUtils.toByteArray(defaultAvatar.getInputStream()));
assertThat(webApp.getAvatarUrl(userService.getUserByName(freefdName)), is(String.format("http://localhost:8080/av-96-%s.png", hash)));
- ClassPathResource newAvatar = new ClassPathResource("cmyk.jpg");
+ ClassPathResource newAvatar = new ClassPathResource("static/durov.png");
byte[] newAvatarData = IOUtils.toByteArray(newAvatar.getInputStream());
mockMvc.perform(MockMvcRequestBuilders.multipart("/api/me/upload")
.file("avatar", newAvatarData)
.with(httpBasic(freefdName, freefdPassword))
).andExpect(status().isOk());
String newHash = DigestUtils.md5DigestAsHex(newAvatarData);
- assertThat(webApp.getAvatarUrl(userService.getUserByName(freefdName)), is(String.format("http://localhost:8080/i/a/%d-%s.png", freefd.getUid(), newHash)));
+ URI newUri = Paths.get(imgDir, "ao", String.format("%d.png", freefd.getUid())).toUri();
+ assertThat(DigestUtils.md5DigestAsHex(IOUtils.toByteArray(newUri)), is(newHash));
}
@Test
public void varyMvcResponse() throws Exception {