commit: 650edb60dcab4a9f4a67c5b7d631636506f3a566
parent 4ba03aa29bb37b13def63fdd5fc8358fe9bde890
Author: Lain Soykaf <lain@lain.com>
Date: Tue, 12 Dec 2023 12:56:07 +0400
ScheduledActivityControllerTest: Fix tests, make async.
Diffstat:
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs
@@ -3,15 +3,25 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
+ alias Pleroma.UnstubbedConfigMock, as: ConfigMock
- import Pleroma.Factory
import Ecto.Query
+ import Mox
+ import Pleroma.Factory
- setup do: clear_config([ScheduledActivity, :enabled])
+ setup do
+ ConfigMock
+ |> stub(:get, fn
+ [ScheduledActivity, :enabled] -> true
+ path -> Pleroma.Test.StaticConfig.get(path)
+ end)
+
+ :ok
+ end
test "shows scheduled activities" do
%{user: user, conn: conn} = oauth_access(["read:statuses"])
@@ -55,7 +65,6 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do
end
test "updates a scheduled activity" do
- clear_config([ScheduledActivity, :enabled], true)
%{user: user, conn: conn} = oauth_access(["write:statuses"])
scheduled_at = Timex.shift(NaiveDateTime.utc_now(), minutes: 60)
@@ -103,7 +112,6 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do
end
test "deletes a scheduled activity" do
- clear_config([ScheduledActivity, :enabled], true)
%{user: user, conn: conn} = oauth_access(["write:statuses"])
scheduled_at = Timex.shift(NaiveDateTime.utc_now(), minutes: 60)