ScheduledActivityControllerTest: Fix tests, make async.

This commit is contained in:
Lain Soykaf 2023-12-12 12:56:07 +04:00
parent 4ba03aa29b
commit 650edb60dc

View File

@ -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)