aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/config_test.exs10
-rw-r--r--test/web/activity_pub/activity_pub_controller_test.exs16
-rw-r--r--test/web/federator_test.exs15
3 files changed, 23 insertions, 18 deletions
diff --git a/test/config_test.exs b/test/config_test.exs
deleted file mode 100644
index 6d0f0a2d4..000000000
--- a/test/config_test.exs
+++ /dev/null
@@ -1,10 +0,0 @@
-defmodule Pleroma.ConfigTest do
- use Pleroma.DataCase
- alias Pleroma.Config
-
- test "get returns the item at the path if there is one" do
- Config.put([:instance, :name], "Plemora")
- assert Config.get([:instance, :name]) == "Plemora"
- assert Config.get([:unknown]) == nil
- end
-end
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs
index 5b46bbe76..524ed9eaa 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -4,12 +4,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
alias Pleroma.Web.ActivityPub.{UserView, ObjectView}
alias Pleroma.{Repo, User}
alias Pleroma.Activity
- alias Pleroma.Config
describe "/relay" do
test "with the relay active, it returns the relay user", %{conn: conn} do
- Config.put([:instance, :allow_relay], true)
-
res =
conn
|> get(activity_pub_path(conn, :relay))
@@ -19,12 +16,23 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
end
test "with the relay disabled, it returns 404", %{conn: conn} do
- Config.put([:instance, :allow_relay], false)
+ instance =
+ Application.get_env(:pleroma, :instance)
+ |> Keyword.put(:allow_relay, false)
+
+ Application.put_env(:pleroma, :instance, instance)
res =
conn
|> get(activity_pub_path(conn, :relay))
|> json_response(404)
+
+ instance =
+ Application.get_env(:pleroma, :instance)
+ |> Keyword.put(:allow_relay, true)
+
+ Application.put_env(:pleroma, :instance, instance)
+
end
end
diff --git a/test/web/federator_test.exs b/test/web/federator_test.exs
index 966702935..88aef0d0f 100644
--- a/test/web/federator_test.exs
+++ b/test/web/federator_test.exs
@@ -1,7 +1,6 @@
defmodule Pleroma.Web.FederatorTest do
alias Pleroma.Web.Federator
alias Pleroma.Web.CommonAPI
- alias Pleroma.Config
use Pleroma.DataCase
import Pleroma.Factory
import Mock
@@ -40,8 +39,6 @@ defmodule Pleroma.Web.FederatorTest do
activity: activity,
relay_mock: relay_mock
} do
- Config.put([:instance, :allow_relay], true)
-
with_mocks([relay_mock]) do
Federator.handle(:publish, activity)
end
@@ -53,13 +50,23 @@ defmodule Pleroma.Web.FederatorTest do
activity: activity,
relay_mock: relay_mock
} do
- Config.put([:instance, :allow_relay], false)
+ instance =
+ Application.get_env(:pleroma, :instance)
+ |> Keyword.put(:allow_relay, false)
+
+ Application.put_env(:pleroma, :instance, instance)
with_mocks([relay_mock]) do
Federator.handle(:publish, activity)
end
refute_received :relay_publish
+
+ instance =
+ Application.get_env(:pleroma, :instance)
+ |> Keyword.put(:allow_relay, true)
+
+ Application.put_env(:pleroma, :instance, instance)
end
end
end