diff options
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 3 | ||||
-rw-r--r-- | test/support/httpoison_mock.ex | 28 |
2 files changed, 30 insertions, 1 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index 7f378915e..1445fe828 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -52,7 +52,8 @@ defmodule Pleroma.Factory do %Pleroma.Activity{ data: data, - actor: data["actor"] + actor: data["actor"], + recipients: data["to"] } end diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 21607ba95..b8f2422f6 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -366,6 +366,34 @@ defmodule HTTPoisonMock do }} end + def get("http://mastodon.example.org/users/admin", ["Accept": "application/activity+json"], _) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json") + }} + end + + def get("https://masto.quad.moe/users/_HellPie", ["Accept": "application/activity+json"], _) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/hellpie.json") + }} + end + + def get("https://niu.moe/users/rye", ["Accept": "application/activity+json"], _) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/rye.json") + }} + end + + def get("http://mastodon.example.org/@admin/99541947525187367", ["Accept": "application/activity+json"], _) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/mastodon-note-object.json") + }} + end + def get(url, body, headers) do {:error, "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{inspect(headers)}"} end |