aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/test/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-28 13:17:55 +0300
committerGravatar Vitaly Takmazov2016-11-28 13:17:55 +0300
commitf9e9dc9daf7393fe5753e24bff051760981552e6 (patch)
treecfd97cd9b710dcd4a990288527f34fbcf2326f76 /juick-api/src/test/java/com/juick
parent1679b35661297fd9a6693b03cadcdbc1ab5a4203 (diff)
juick-api: red test for anonymous apis
Diffstat (limited to 'juick-api/src/test/java/com/juick')
-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)));
+ }
}