summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2023-12-11 09:43:49 +0400
committerLain Soykaf <lain@lain.com>2023-12-11 09:43:49 +0400
commit3cce929eecdbabfb4bf31938851239f8418c7ba2 (patch)
tree7cbba7aa94bc56875c9000d79a0c7ce8cefce497
parent90a47ca050c5839e8b4dc3bac315dc436d49152d (diff)
downloadpleroma-3cce929eecdbabfb4bf31938851239f8418c7ba2.tar.gz
pleroma-3cce929eecdbabfb4bf31938851239f8418c7ba2.zip
ChatValidationTest: Fix tests.
-rw-r--r--test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs11
-rw-r--r--test/test_helper.exs9
2 files changed, 20 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs
index 8192efe97..812944452 100644
--- a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs
@@ -5,11 +5,13 @@
defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
use Pleroma.DataCase
alias Pleroma.Object
+ alias Pleroma.UnstubbedConfigMock, as: ConfigMock
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
alias Pleroma.Web.CommonAPI
+ import Mox
import Pleroma.Factory
describe "chat message create activities" do
@@ -82,6 +84,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
filename: "an_image.jpg"
}
+ ConfigMock
+ |> stub_with(Pleroma.Test.StaticConfig)
+
{:ok, attachment} = ActivityPub.upload(file, actor: user.ap_id)
valid_chat_message =
@@ -103,6 +108,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
filename: "an_image.jpg"
}
+ ConfigMock
+ |> stub_with(Pleroma.Test.StaticConfig)
+
{:ok, attachment} = ActivityPub.upload(file, actor: user.ap_id)
valid_chat_message =
@@ -124,6 +132,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
filename: "an_image.jpg"
}
+ ConfigMock
+ |> stub_with(Pleroma.Test.StaticConfig)
+
{:ok, attachment} = ActivityPub.upload(file, actor: user.ap_id)
valid_chat_message =
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 7727cffbc..ddce27015 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -18,3 +18,12 @@ ExUnit.after_suite(fn _results ->
uploads = Pleroma.Config.get([Pleroma.Uploaders.Local, :uploads], "test/uploads")
File.rm_rf!(uploads)
end)
+
+defmodule Pleroma.Test.StaticConfig do
+ @behaviour Pleroma.Config.Getting
+ @config Application.get_all_env(:pleroma)
+
+ def get(path, default \\ nil) do
+ get_in(@config, path) || default
+ end
+end