blob: 1455a1c467ddce6ecd832a71b5b9367126ef83de (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 | defmodule Pleroma.Web.FederatingPlugTest do
  use Pleroma.Web.ConnCase
  test "returns and halt the conn when federating is disabled" do
    instance =
      Application.get_env(:pleroma, :instance)
      |> Keyword.put(:federating, false)
    Application.put_env(:pleroma, :instance, instance)
    conn =
      build_conn()
      |> Pleroma.Web.FederatingPlug.call(%{})
    assert conn.status == 404
    assert conn.halted
    instance =
      Application.get_env(:pleroma, :instance)
      |> Keyword.put(:federating, true)
    Application.put_env(:pleroma, :instance, instance)
  end
  test "does nothing when federating is enabled" do
    conn =
      build_conn()
      |> Pleroma.Web.FederatingPlug.call(%{})
    refute conn.status
    refute conn.halted
  end
end
 |