From f32e19f66881ed0939d83e2810c29081d5b11e16 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 May 2018 06:11:45 +0000 Subject: webfinger: add tests --- test/support/httpoison_mock.ex | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 4a5a9ea85..e733afa59 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -3,6 +3,18 @@ defmodule HTTPoisonMock do def get(url, body \\ [], headers \\ []) + def get( + "http://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de", + [Accept: "application/xrd+xml,application/jrd+json"], + follow_redirect: true + ) do + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json") + }} + end + def get( "http://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org", [Accept: "application/xrd+xml,application/jrd+json"], -- cgit v1.2.3 From 4033ed671443bbb4111b45473696dc8a23fe9873 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 May 2018 08:25:45 +0000 Subject: tests: add test for hubzilla follow activity too --- test/support/httpoison_mock.ex | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 4a5a9ea85..ad5171492 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -628,6 +628,14 @@ defmodule HTTPoisonMock do }} end + def get("https://hubzilla.example.org/channel/kaniini", [Accept: "application/activity+json"], _) do + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json") + }} + end + def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do {:ok, %Response{ -- cgit v1.2.3 From 6e8de2faae46f3dcaf6881ab40664da0057551e4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 May 2018 08:37:04 +0000 Subject: run mix format --- test/support/httpoison_mock.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index ad5171492..6bbae70e1 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -628,7 +628,11 @@ defmodule HTTPoisonMock do }} end - def get("https://hubzilla.example.org/channel/kaniini", [Accept: "application/activity+json"], _) do + def get( + "https://hubzilla.example.org/channel/kaniini", + [Accept: "application/activity+json"], + _ + ) do {:ok, %Response{ status_code: 200, -- cgit v1.2.3 From 725b05d04aecaa00d5b79c81958267444bf3c91d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 May 2018 08:48:15 +0000 Subject: run mix format --- test/support/httpoison_mock.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index e733afa59..a1a542103 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -8,11 +8,11 @@ defmodule HTTPoisonMock do [Accept: "application/xrd+xml,application/jrd+json"], follow_redirect: true ) do - {:ok, - %Response{ - status_code: 200, - body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json") - }} + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json") + }} end def get( -- cgit v1.2.3