Merge branch 'develop' into feature/digest-email
[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
8 test "returns and halt the conn when federating is disabled" do
9 Pleroma.Config.put([:instance, :federating], false)
10
11 conn =
12 build_conn()
13 |> Pleroma.Web.FederatingPlug.call(%{})
14
15 assert conn.status == 404
16 assert conn.halted
17
18 Pleroma.Config.put([:instance, :federating], true)
19 end
20
21 test "does nothing when federating is enabled" do
22 conn =
23 build_conn()
24 |> Pleroma.Web.FederatingPlug.call(%{})
25
26 refute conn.status
27 refute conn.halted
28 end
29 end