diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2020-03-16 15:31:31 +0400 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2020-03-16 15:31:31 +0400 | 
| commit | 421e35b578b3fc109f820f693e91139a3e3f8970 (patch) | |
| tree | 37da58962582854597cd068c603b8ba23e10f7bb /test/support | |
| parent | d1c7f8e576e31487544b57d67802843b8ef38388 (diff) | |
| parent | c2527b8c63a4e35b121981efe2c39cc54c77648d (diff) | |
| download | pleroma-421e35b578b3fc109f820f693e91139a3e3f8970.tar.gz pleroma-421e35b578b3fc109f820f693e91139a3e3f8970.zip | |
Merge branch 'develop' into global-status-expiration
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 | 
