aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-02-24 19:29:36 +0300
committerGravatar Vitaly Takmazov2019-02-24 19:29:36 +0300
commite9a3361b31ae49a801b03bd2950e38896b1f3863 (patch)
tree71e9acb59e1c7ae166d26e99f125a233e52b46ca /src/test/java
parenta7d29047bd49ae8afc887abba0317ba7d4aa49b1 (diff)
/.well-known/nodeinfo
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index a509b36d..5c421f07 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -19,6 +19,7 @@ package com.juick.server.tests;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gargoylesoftware.htmlunit.CookieManager;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -1961,4 +1962,28 @@ public class ServerTests {
Follow follow = jsonMapper.readValue(followData, Follow.class);
assertThat(follow.getActor(), is("https://ussr.win/channel/zlax"));
}
+ @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());
+ }
}