From 9c1b6f11c501756362342b5652769c9dfd12e77c Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 21 Jul 2018 02:57:56 +0900 Subject: improve test --- test/support/factory.ex | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index b2e98c8d1..e9b4beb7d 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -65,6 +65,26 @@ defmodule Pleroma.Factory do } end + def announce_activity_factory do + note_activity = insert(:note_activity) + user = insert(:user) + + data = %{ + "type" => "Announce", + "actor" => note_activity.actor, + "object" => note_activity.data["id"], + "to" => [user.follower_address, note_activity.data["actor"]], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "context" => note_activity.data["context"] + } + + %Pleroma.Activity{ + data: data, + actor: user.ap_id, + recipients: data["to"] + } + end + def like_activity_factory do note_activity = insert(:note_activity) user = insert(:user) -- cgit v1.2.3 From 7fbcd4caaf877749c13d6755eaaa956ac0ea5012 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 14 Aug 2018 17:07:01 +0000 Subject: test: add kroeg fixtures --- 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 a52d44ed6..dc83b115e 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( + "https://puckipedia.com/", + [Accept: "application/activity+json"], + [] + ) do + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json") + }} + end + def get( "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de", [Accept: "application/xrd+xml,application/jrd+json"], -- cgit v1.2.3 From b8560e5ed5612e37af8a759128e322025922a862 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 14 Aug 2018 17:15:33 +0000 Subject: testsuite: formatting --- test/support/httpoison_mock.ex | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index dc83b115e..527c2e1f7 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -3,11 +3,7 @@ defmodule HTTPoisonMock do def get(url, body \\ [], headers \\ []) - def get( - "https://puckipedia.com/", - [Accept: "application/activity+json"], - [] - ) do + def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do {:ok, %Response{ status_code: 200, -- cgit v1.2.3 From 74c74decf522104cb08c600a96849e6b0fab1780 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 12 Jul 2018 19:06:28 +0200 Subject: Basic peertube support. --- test/support/httpoison_mock.ex | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/support') diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 527c2e1f7..4ee2feb95 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -760,6 +760,22 @@ defmodule HTTPoisonMock do }} end + def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json") + }} + end + + def get("https://peertube.moe/accounts/7even", _, _) do + {:ok, + %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/7even.json") + }} + end + def get(url, body, headers) do {:error, "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{ -- cgit v1.2.3