diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-03-16 17:58:42 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-03-16 17:58:42 +0300 |
commit | 0e07c5ef5717460d37336129cb657ba11091f09d (patch) | |
tree | 801cb7957ebe2e4f227f089afc902ea2084eaf27 /test/support | |
parent | 7c8003c3fcdcab075b9722ab236bf2d1d0e0e8cd (diff) | |
parent | b80958d4e3fb9cdbb9b10149a52f1441edb4b1e3 (diff) | |
download | pleroma-0e07c5ef5717460d37336129cb657ba11091f09d.tar.gz pleroma-0e07c5ef5717460d37336129cb657ba11091f09d.zip |
Merge remote-tracking branch 'remotes/origin/develop' into 1364-notifications-sending-control
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/conn_case.ex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 0f2e81f9e..064874201 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -26,6 +26,8 @@ defmodule Pleroma.Web.ConnCase do use Pleroma.Tests.Helpers import Pleroma.Web.Router.Helpers + alias Pleroma.Config + # The default endpoint for testing @endpoint Pleroma.Web.Endpoint @@ -48,6 +50,28 @@ defmodule Pleroma.Web.ConnCase do %{user: user, token: token, conn: conn} end + + defp ensure_federating_or_authenticated(conn, url, user) do + initial_setting = Config.get([:instance, :federating]) + on_exit(fn -> Config.put([:instance, :federating], initial_setting) end) + + Config.put([:instance, :federating], false) + + conn + |> get(url) + |> response(403) + + conn + |> assign(:user, user) + |> get(url) + |> response(200) + + Config.put([:instance, :federating], true) + + conn + |> get(url) + |> response(200) + end end end |