diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-04 17:48:55 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-04 17:48:55 +0300 |
commit | dd8aee332cf939f1a76f60a95b117ab90530178b (patch) | |
tree | 509ec960e9bb272183916df8ed3ab929ae936519 /test | |
parent | 5c6d47614dfd72566a91ac58223902e71ebdf1d3 (diff) | |
download | pleroma-dd8aee332cf939f1a76f60a95b117ab90530178b.tar.gz pleroma-dd8aee332cf939f1a76f60a95b117ab90530178b.zip |
formatting the code
Diffstat (limited to 'test')
-rw-r--r-- | test/formatter_test.exs | 1 | ||||
-rw-r--r-- | test/support/http_request_mock.ex | 60 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 2 | ||||
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 1 |
4 files changed, 49 insertions, 15 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs index d5c74a321..5d745510f 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -4,6 +4,7 @@ defmodule Pleroma.FormatterTest do use Pleroma.DataCase import Pleroma.Factory + setup_all do Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) :ok diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index c1b1c8589..391342ad7 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -14,7 +14,7 @@ defmodule HttpRequestMock do res else {_, r} = error -> - #Logger.warn(r) + # Logger.warn(r) error end end @@ -27,13 +27,17 @@ defmodule HttpRequestMock do {:ok, %Tesla.Env{ status: 200, - body: File.read!( - "test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json" - ) + body: + File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json") }} end - def get("https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com", _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, @@ -41,8 +45,12 @@ defmodule HttpRequestMock do }} end - def get("https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191", - _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, @@ -58,8 +66,12 @@ defmodule HttpRequestMock do }} end - def get("https://pawoo.net/.well-known/webfinger?resource=acct:https://pawoo.net/users/pekorino", - _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://pawoo.net/.well-known/webfinger?resource=acct:https://pawoo.net/users/pekorino", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, @@ -67,7 +79,12 @@ defmodule HttpRequestMock do }} end - def get("https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom", _, _, _) do + def get( + "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom", + _, + _, + _ + ) do {:ok, %Tesla.Env{ status: 200, @@ -75,8 +92,12 @@ defmodule HttpRequestMock do }} end - def get("https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=acct:https://social.stopwatchingus-heidelberg.de/user/18330", - _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=acct:https://social.stopwatchingus-heidelberg.de/user/18330", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, @@ -92,8 +113,12 @@ defmodule HttpRequestMock do }} end - def get("https://mamot.fr/.well-known/webfinger?resource=acct:https://mamot.fr/users/Skruyb", - _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://mamot.fr/.well-known/webfinger?resource=acct:https://mamot.fr/users/Skruyb", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, @@ -101,7 +126,12 @@ defmodule HttpRequestMock do }} end - def get("https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la", _, _, [Accept: "application/xrd+xml,application/jrd+json"]) do + def get( + "https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la", + _, + _, + Accept: "application/xrd+xml,application/jrd+json" + ) do {:ok, %Tesla.Env{ status: 200, diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs index 414759110..980f43553 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/web/activity_pub/activity_pub_controller_test.exs @@ -4,10 +4,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do alias Pleroma.Web.ActivityPub.{UserView, ObjectView} alias Pleroma.{Repo, User} alias Pleroma.Activity + setup_all do Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) :ok end + describe "/relay" do test "with the relay active, it returns the relay user", %{conn: conn} do res = diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index eeb0cb5cf..fa526a222 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -11,6 +11,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do import Pleroma.Factory alias Pleroma.Web.CommonAPI + setup_all do Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) :ok |