Merge branch 'tests/prismo-url-map' into 'develop'
[akkoma] / test / web / plugs / federating_plug_test.exs
1 defmodule Pleroma.Web.FederatingPlugTest do
2 use Pleroma.Web.ConnCase
3
4 test "returns and halt the conn when federating is disabled" do
5 instance =
6 Application.get_env(:pleroma, :instance)
7 |> Keyword.put(:federating, false)
8
9 Application.put_env(:pleroma, :instance, instance)
10
11 conn =
12 build_conn()
13 |> Pleroma.Web.FederatingPlug.call(%{})
14
15 assert conn.status == 404
16 assert conn.halted
17
18 instance =
19 Application.get_env(:pleroma, :instance)
20 |> Keyword.put(:federating, true)
21
22 Application.put_env(:pleroma, :instance, instance)
23 end
24
25 test "does nothing when federating is enabled" do
26 conn =
27 build_conn()
28 |> Pleroma.Web.FederatingPlug.call(%{})
29
30 refute conn.status
31 refute conn.halted
32 end
33 end