aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-18 22:33:48 +0300
committerGravatar Vitaly Takmazov2019-03-18 22:33:48 +0300
commitecdaf52bac011cdd0f17c94abf1174fc722331fa (patch)
tree6e3b61917a6cc5071f68fd0344f7d73cb4ecac51 /src/test/java
parent477ed00317dbef73604e1175bc547f7cd0869075 (diff)
WebFinger is HTTPS-only protocol
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 7f46968f..ea99fac3 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -33,6 +33,7 @@ import com.juick.model.CommandResult;
import com.juick.model.PrivateChats;
import com.juick.model.TagStats;
import com.juick.server.*;
+import com.juick.server.api.activity.Profile;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.activities.*;
import com.juick.server.api.activity.model.objects.Note;
@@ -198,6 +199,8 @@ public class ServerTests {
private WebApp webApp;
@Inject
private RestTemplate apClient;
+ @Inject
+ private Profile profileController;
@Value("classpath:mocks/activity/testuser.json")
private Resource testuserResponse;
@@ -1408,8 +1411,6 @@ public class ServerTests {
.andExpect(jsonPath("$.links[0].href", is("http://localhost:8080/u/ugnich")));
mockMvc.perform(get("/.well-known/webfinger?resource=acct:durov@localhost"))
.andExpect(status().isNotFound());
- Person ugnich = (Person) signatureManager.discoverPerson("ugnich@juick.com").get();
- assertThat(ugnich.getName(), is(ugnichName));
}
@Test
public void userProfileAndBlogShouldBeExposedAsActivityStream() throws Exception {
@@ -1747,10 +1748,15 @@ public class ServerTests {
@Test
public void serviceSignatureAuth() throws Exception {
String meUri = "/api/me";
- String testHost = "localhost:8080";
- Person ugnichPerson = (Person) signatureManager.discoverPerson("ugnich@localhost:8080").get();
Instant now = Instant.now();
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");
+ now = Instant.now();
+ requestDate = DateFormattersHolder.getHttpDateFormatter().format(now);
String signatureString = signatureManager.addSignature(ugnichPerson, testHost, "GET", meUri, requestDate);
MvcResult me = mockMvc.perform(get("/api/me")
.header("Host", testHost)