Update test
[akkoma] / test / support / http_request_mock.ex
index eb692fab5d1366e707578496b819bb305e3e1c8e..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{
@@ -1289,9 +1313,7 @@ defmodule HttpRequestMock do
 
   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
@@ -1357,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.
@@ -1374,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