diff options
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index d0f4032a..84034428 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -288,6 +288,10 @@ public class ServerTests { .orElseThrow(IllegalStateException::new); ugnich = makeUserVerified(ugnich); freefd = makeUserVerified(freefd); + assertThat(ugnich.getLanguage(), is("__")); + ugnich.setLanguage("en"); + userService.updateLanguage(ugnich); + assertThat(ugnich.getLanguage(), is("en")); webClient.getOptions().setJavaScriptEnabled(false); webClient.getOptions().setCssEnabled(false); isSetUp = true; @@ -1524,8 +1528,8 @@ public class ServerTests { jsonMapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); String jsonUser = jsonMapper.writeValueAsString(yyy); Map<String, Object> user = JsonPath.read(jsonUser, "$"); - // only uid, name and uri - assertThat(user.keySet().size(), is(3)); + // only uid, name, lang and uri + assertThat(user.keySet().size(), is(4)); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); @@ -1637,19 +1641,6 @@ public class ServerTests { } @Test - public void accountUrlShouldBeExposedOverWebfinger() throws Exception { - mockMvc.perform(get("/.well-known/webfinger?resource=acct:ugnich@" + webDomain) - .accept("application/jrd+json")).andExpect(status().isOk()) - .andExpect(jsonPath("$.subject", is("acct:ugnich@" + webDomain))) - .andExpect(jsonPath("$.links", hasSize(1))) - .andExpect(jsonPath("$.links[0].href", is(baseUri + "u/ugnich"))); - mockMvc.perform(get("/.well-known/webfinger?resource=acct:durov@" + webDomain)) - .andExpect(status().isNotFound()); - mockMvc.perform(get("/.well-known/webfinger?resource=acct:@" + webDomain)) - .andExpect(status().isNotFound()); - } - - @Test public void userProfileAndBlogShouldBeExposedAsActivityStream() throws Exception { ClassPathResource defaultAvatar = new ClassPathResource("static/av-96.png"); String hash = DigestUtils.md5DigestAsHex(IOUtils.toByteArray(defaultAvatar.getInputStream())); @@ -2086,14 +2077,6 @@ public class ServerTests { } @Test - public void hostmeta() throws Exception { - MvcResult result = mockMvc.perform(get("/.well-known/host-meta")).andExpect(status().isOk()) - .andReturn(); - String xrd = result.getResponse().getContentAsString(); - result = mockMvc.perform(get("/.well-known/x-nodeinfo2")).andExpect(status().isOk()).andReturn(); - } - - @Test public void pms() throws Exception { jdbcTemplate.execute("DELETE FROM pm"); jdbcTemplate.execute("DELETE FROM bl_users"); @@ -2319,27 +2302,6 @@ public class ServerTests { } @Test - public void nodeinfo() throws Exception { - MvcResult nodeinfoXRD = mockMvc - .perform(get("/.well-known/nodeinfo").contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn(); - JsonNode node = jsonMapper.readTree(nodeinfoXRD.getResponse().getContentAsString()); - assertThat(node.get("links"), notNullValue()); - String nodeinfoUrl = node.get("links").get(0).get("href").textValue(); - MvcResult nodeinfoData = mockMvc.perform(get(nodeinfoUrl).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn(); - JsonNode nodeinfo = jsonMapper.readTree(nodeinfoData.getResponse().getContentAsString()); - assertThat(nodeinfo.get("software"), notNullValue()); - assertThat(nodeinfo.get("server"), nullValue()); - MvcResult xnodeinfoData = mockMvc - .perform(get("/.well-known/x-nodeinfo2").contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn(); - JsonNode xnodeinfo = jsonMapper.readTree(xnodeinfoData.getResponse().getContentAsString()); - assertThat(xnodeinfo.get("server"), notNullValue()); - assertThat(xnodeinfo.get("software"), nullValue()); - } - - @Test public void anonymousUserFromZero() { User user = userService.getUserByUID(0).orElse(AnonymousUser.INSTANCE); assertThat(user.isAnonymous(), is(true)); |