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