aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/test/java/com/juick/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/test/java/com/juick/api')
-rw-r--r--juick-api/src/test/java/com/juick/api/tests/MessagesTests.java20
1 files changed, 20 insertions, 0 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 cec2bc7d..66cd6048 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
@@ -229,4 +229,24 @@ public class MessagesTests {
.andExpect(header().string("Access-Control-Allow-Methods", "POST,GET,PUT,OPTIONS,DELETE"))
.andExpect(header().string("Access-Control-Allow-Headers", "X-PINGOTHER, Content-Type"));
}
+ @Test
+ public void anonymousApis() throws Exception {
+ String ugnichName = "ugnich";
+ String uginchPassword = "MyPassw0rd!";
+ String freefdName = "freefd";
+ String freefdPassword = "MyPassw0rd!";
+ User ugnich = getUser(1, ugnichName, uginchPassword);
+ User freefd = getUser(2, freefdName, freefdPassword);
+ when(userService.getFullyUserByName(ugnichName))
+ .thenReturn(ugnich);
+ when(userService.getFullyUserByName(freefdName))
+ .thenReturn(freefd);
+ mockMvc.perform(get("/messages"))
+ .andExpect(status().isOk());
+ mockMvc.perform(get("/users")
+ .param("uname", "ugnich").param("uname", "freefd"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
+ .andExpect(jsonPath("$", hasSize(2)));
+ }
}