aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-27 19:57:28 +0300
committerGravatar Vitaly Takmazov2016-11-27 19:57:28 +0300
commit9241901c9367259eebf1128c0693f9bc3f3597a5 (patch)
tree6a695b709db8fb834153be3f490c8b67540884c9 /juick-api/src/test
parenta1dfdabfa7a43b28d827458a0b4c5f6a2a1a9013 (diff)
juick-api: add hash-based authentication filter
Diffstat (limited to 'juick-api/src/test')
-rw-r--r--juick-api/src/test/java/com/juick/api/tests/MessagesTests.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
index 6996adb9..0b16ae7f 100644
--- a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
+++ b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
@@ -6,6 +6,7 @@ import com.juick.User;
import com.juick.api.configuration.ApiAppConfiguration;
import com.juick.api.configuration.ApiMvcConfiguration;
import com.juick.api.configuration.ApiSecurityConfig;
+import com.juick.api.configuration.JuickHashFilter;
import com.juick.configuration.DataConfiguration;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
@@ -118,7 +119,9 @@ public class MessagesTests {
.andExpect(jsonPath("$[0].body", is(msgText)));
String hash = RandomStringUtils.random(16);
when(userService.getHashByUID(1)).thenReturn(hash);
- mockMvc.perform(get("/messages")
+ when(userService.getUserByHash(hash)).thenReturn(user);
+ when(userService.getUIDbyHash(hash)).thenReturn(1);
+ mockMvc.perform(get("/home")
.param("hash", hash))
.andExpect(status().isOk());
}