Merge remote-tracking branch 'remotes/origin/develop' into ostatus-controller-no...
[akkoma] / test / pleroma / web / plugs / federating_plug_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Plugs.FederatingPlugTest do
6 use Pleroma.Web.ConnCase
7
8 setup do: clear_config([:instance, :federating])
9
10 test "returns and halt the conn when federating is disabled" do
11 Pleroma.Config.put([:instance, :federating], false)
12
13 conn =
14 build_conn()
15 |> Pleroma.Web.Plugs.FederatingPlug.call(%{})
16
17 assert conn.status == 404
18 assert conn.halted
19 end
20
21 test "does nothing when federating is enabled" do
22 Pleroma.Config.put([:instance, :federating], true)
23
24 conn =
25 build_conn()
26 |> Pleroma.Web.Plugs.FederatingPlug.call(%{})
27
28 refute conn.status
29 refute conn.halted
30 end
31 end