Merge branch 'relay-list-change' into 'develop'
[akkoma] / test / support / http_request_mock.ex
index f43de700d98a210bb4f2f98340d3d88879277587..e72638814804b765b48763417eaeaaf0cffe477c 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule HttpRequestMock do
@@ -19,7 +19,7 @@ defmodule HttpRequestMock do
     else
       error ->
         with {:error, message} <- error do
-          Logger.warn(message)
+          Logger.warn(to_string(message))
         end
 
         {_, _r} = error
@@ -1277,6 +1277,10 @@ defmodule HttpRequestMock do
     {:ok, %Tesla.Env{status: 404, body: ""}}
   end
 
+  def get("https://relay.mastodon.host/actor", _, _, _) do
+    {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
+  end
+
   def get(url, query, body, headers) do
     {:error,
      "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
@@ -1289,6 +1293,10 @@ defmodule HttpRequestMock do
 
   def post(url, query \\ [], body \\ [], headers \\ [])
 
+  def post("https://relay.mastodon.host/inbox", _, _, _) do
+    {:ok, %Tesla.Env{status: 200, body: ""}}
+  end
+
   def post("http://example.org/needs_refresh", _, _, _) do
     {:ok,
      %Tesla.Env{