Merge remote-tracking branch 'origin/develop' into moderators
[akkoma] / test / support / http_request_mock.ex
index 1e98020f0106b048cec226fdfdf47427c774c3c7..94900dc144944665c6912e30ecd86d355fbfc408 100644 (file)
@@ -89,6 +89,18 @@ defmodule HttpRequestMock do
      }}
   end
 
+  def get("https://mastodon.sdf.org/users/rinpatch/collections/featured", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body:
+         File.read!("test/fixtures/users_mock/masto_featured.json")
+         |> String.replace("{{domain}}", "mastodon.sdf.org")
+         |> String.replace("{{nickname}}", "rinpatch"),
+       headers: [{"content-type", "application/activity+json"}]
+     }}
+  end
+
   def get("https://patch.cx/objects/tesla_mock/poll_attachment", _, _, _) do
     {:ok,
      %Tesla.Env{
@@ -905,6 +917,18 @@ defmodule HttpRequestMock do
      }}
   end
 
+  def get("https://mastodon.social/users/lambadalambda/collections/featured", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body:
+         File.read!("test/fixtures/users_mock/masto_featured.json")
+         |> String.replace("{{domain}}", "mastodon.social")
+         |> String.replace("{{nickname}}", "lambadalambda"),
+       headers: activitypub_object_headers()
+     }}
+  end
+
   def get("https://apfed.club/channel/indio", _, _, _) do
     {:ok,
      %Tesla.Env{
@@ -1278,11 +1302,18 @@ defmodule HttpRequestMock do
      }}
   end
 
+  def get("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body: File.read!("test/fixtures/tesla_mock/emoji-in-summary.json"),
+       headers: activitypub_object_headers()
+     }}
+  end
+
   def get(url, query, body, headers) do
     {:error,
-     "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
-       inspect(headers)
-     }"}
+     "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
   end
 
   # POST Requests
@@ -1348,9 +1379,7 @@ defmodule HttpRequestMock do
 
   def post(url, query, body, headers) do
     {:error,
-     "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{
-       inspect(headers)
-     }"}
+     "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
   end
 
   # Most of the rich media mocks are missing HEAD requests, so we just return 404.
@@ -1365,8 +1394,6 @@ defmodule HttpRequestMock do
 
   def head(url, query, body, headers) do
     {:error,
-     "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{
-       inspect(headers)
-     }"}
+     "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
   end
 end