2019-12-03 10:29:51 +00: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-26 20:36:50 +00:00
|
|
|
defmodule Mobilizon.Web.Plug.FederatingTest do
|
|
|
|
use Mobilizon.Web.ConnCase
|
2019-12-03 10:29:51 +00:00
|
|
|
|
2020-01-26 20:36:50 +00:00
|
|
|
alias Mobilizon.Web.Plugs.Federating
|
2020-01-22 23:55:07 +00:00
|
|
|
|
2019-12-03 10:29:51 +00:00
|
|
|
test "returns and halt the conn when federating is disabled" do
|
|
|
|
Mobilizon.Config.put([:instance, :federating], false)
|
|
|
|
|
2020-01-22 23:55:07 +00:00
|
|
|
conn = Federating.call(build_conn(), %{})
|
2019-12-03 10:29:51 +00: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-22 23:55:07 +00:00
|
|
|
conn = Federating.call(build_conn(), %{})
|
2019-12-03 10:29:51 +00:00
|
|
|
|
|
|
|
refute conn.status
|
|
|
|
refute conn.halted
|
|
|
|
end
|
|
|
|
end
|