aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server/tests/ServerTests.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-01-14 08:09:48 +0300
committerGravatar Vitaly Takmazov2021-01-14 08:10:08 +0300
commitcbd8fcd4ff5311ddc889039106d63fd51bd561c9 (patch)
tree6a5c807146ac2d7a5260bee3fda206ad54a1dbad /src/test/java/com/juick/server/tests/ServerTests.java
parent1576aa82d9108c24720617eaf15fe9f112201ffd (diff)
tests: use multipart mock constructor with original filename
Diffstat (limited to 'src/test/java/com/juick/server/tests/ServerTests.java')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 33b0f0da..cea3818e 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -89,6 +89,7 @@ import org.springframework.core.io.Resource;
import org.springframework.http.*;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.client.MockRestServiceServer;
@@ -2077,7 +2078,7 @@ public class ServerTests {
ClassPathResource newAvatar = new ClassPathResource("static/durov.png");
byte[] newAvatarData = IOUtils.toByteArray(newAvatar.getInputStream());
mockMvc.perform(MockMvcRequestBuilders.multipart("/api/me/upload")
- .file("avatar", newAvatarData)
+ .file(new MockMultipartFile("avatar", "durov.png", "image/png", newAvatarData))
.with(httpBasic(freefdName, freefdPassword))
).andExpect(status().isOk());
String newHash = DigestUtils.md5DigestAsHex(newAvatarData);