From 03d42d6e6ccaee4ff9d2a0808e51e5f9f0dc18c3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Aug 2021 06:55:37 +0300 Subject: ActivityPub: return Application profile for service user --- src/test/java/com/juick/server/tests/ServerTests.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/test/java/com/juick/server/tests') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index c11dfb46..bcdb4af3 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -39,6 +39,7 @@ import com.juick.www.api.Users; import com.juick.www.api.activity.Profile; import com.juick.www.api.activity.model.Context; import com.juick.www.api.activity.model.activities.*; +import com.juick.www.api.activity.model.objects.Actor; import com.juick.www.api.activity.model.objects.Application; import com.juick.www.api.activity.model.objects.Image; import com.juick.www.api.activity.model.objects.Note; @@ -1863,7 +1864,7 @@ public class ServerTests { String requestDate = DateFormattersHolder.getHttpDateFormatter().format(now); mockMvc.perform(get("/api/me").header("Date", requestDate)).andExpect(status().isUnauthorized()); String testHost = "localhost"; - Person ugnichPerson = profileController.getUser("ugnich"); + Actor ugnichPerson = profileController.getUser("ugnich"); now = Instant.now(); requestDate = DateFormattersHolder.getHttpDateFormatter().format(now); String signatureString = signatureManager.addSignature(ugnichPerson, testHost, "GET", meUri, requestDate, @@ -1924,6 +1925,14 @@ public class ServerTests { apClient.setRequestFactory(originalRequestFactory); } + @Test + public void serviceUserProfileIsApplicationProfile() throws Exception { + MvcResult response = mockMvc.perform(get("/u/juick") + .accept(Context.ACTIVITY_MEDIA_TYPE)).andReturn(); + Actor actor = jsonMapper.readValue(response.getResponse().getContentAsString(), Actor.class); + assertThat(actor, is(instanceOf(Application.class))); + } + @Test public void hostmeta() throws Exception { MvcResult result = mockMvc.perform(get("/.well-known/host-meta")).andExpect(status().isOk()).andReturn(); -- cgit v1.2.3