Mastodon Conversation API: Don't return own account in 'accounts'.
[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 instance =
10 Application.get_env(:pleroma, :instance)
11 |> Keyword.put(:federating, false)
12
13 Application.put_env(:pleroma, :instance, instance)
14
15 conn =
16 build_conn()
17 |> Pleroma.Web.FederatingPlug.call(%{})
18
19 assert conn.status == 404
20 assert conn.halted
21
22 instance =
23 Application.get_env(:pleroma, :instance)
24 |> Keyword.put(:federating, true)
25
26 Application.put_env(:pleroma, :instance, instance)
27 end
28
29 test "does nothing when federating is enabled" do
30 conn =
31 build_conn()
32 |> Pleroma.Web.FederatingPlug.call(%{})
33
34 refute conn.status
35 refute conn.halted
36 end
37 end