2019-12-03 11:29:51 +01:00
|
|
|
# Portions of this file are derived from Pleroma:
|
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-01-23 00:55:07 +01:00
|
|
|
defmodule Mobilizon.Federation.Plug.FederatingTest do
|
2019-12-03 11:29:51 +01:00
|
|
|
use MobilizonWeb.ConnCase
|
|
|
|
|
2020-01-23 00:55:07 +01:00
|
|
|
alias Mobilizon.Federation.Plugs.Federating
|
|
|
|
|
2019-12-03 11:29:51 +01:00
|
|
|
test "returns and halt the conn when federating is disabled" do
|
|
|
|
Mobilizon.Config.put([:instance, :federating], false)
|
|
|
|
|
2020-01-23 00:55:07 +01:00
|
|
|
conn = Federating.call(build_conn(), %{})
|
2019-12-03 11:29:51 +01:00
|
|
|
|
|
|
|
assert conn.status == 404
|
|
|
|
assert conn.halted
|
|
|
|
end
|
|
|
|
|
|
|
|
test "does nothing when federating is enabled" do
|
|
|
|
Mobilizon.Config.put([:instance, :federating], true)
|
|
|
|
|
2020-01-23 00:55:07 +01:00
|
|
|
conn = Federating.call(build_conn(), %{})
|
2019-12-03 11:29:51 +01:00
|
|
|
|
|
|
|
refute conn.status
|
|
|
|
refute conn.halted
|
|
|
|
end
|
|
|
|
end
|