commit: 3cce929eecdbabfb4bf31938851239f8418c7ba2
parent 90a47ca050c5839e8b4dc3bac315dc436d49152d
Author: Lain Soykaf <lain@lain.com>
Date: Mon, 11 Dec 2023 09:43:49 +0400
ChatValidationTest: Fix tests.
Diffstat:
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
@@ -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
@@ -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