add http requests mock

This commit is contained in:
Maksim Pechnikov 2018-12-02 18:17:26 +03:00
commit c508d41c34
3 changed files with 86 additions and 7 deletions

View file

@ -13,13 +13,7 @@ defmodule Pleroma.Web.WebsubTest do
import Tesla.Mock
setup do
mock fn
%{method: :get, url: "https://mastodon.social/users/lambadalambda.atom"} ->
%Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.atom")}
%{method: :post, url: "http://example.org/needs_refresh"} ->
%Tesla.Env{status: 200, body: ""}
end
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
end