mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-03 05:48:42 +00:00
Remove test superceded by logic change
We will not be inserting jobs that should be skipped due to updated_at
This commit is contained in:
parent
ba2ae5e40b
commit
fa8de790df
1 changed files with 21 additions and 40 deletions
|
@ -53,51 +53,32 @@ defmodule Pleroma.Workers.PollWorkerTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "poll refresh" do
|
test "poll refresh" do
|
||||||
test "normal job" do
|
user = insert(:user, local: false)
|
||||||
user = insert(:user, local: false)
|
question = insert(:question, user: user)
|
||||||
question = insert(:question, user: user)
|
activity = insert(:question_activity, question: question)
|
||||||
activity = insert(:question_activity, question: question)
|
|
||||||
|
|
||||||
PollWorker.new(%{"op" => "refresh", "activity_id" => activity.id})
|
PollWorker.new(%{"op" => "refresh", "activity_id" => activity.id})
|
||||||
|> Oban.insert()
|
|> Oban.insert()
|
||||||
|
|
||||||
expected_job_args = %{"activity_id" => activity.id, "op" => "refresh"}
|
expected_job_args = %{"activity_id" => activity.id, "op" => "refresh"}
|
||||||
|
|
||||||
assert_enqueued(args: expected_job_args)
|
assert_enqueued(args: expected_job_args)
|
||||||
|
|
||||||
with_mocks([
|
|
||||||
{
|
|
||||||
Pleroma.Web.Streamer,
|
|
||||||
[],
|
|
||||||
[
|
|
||||||
stream: fn _, _ -> nil end
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]) do
|
|
||||||
[job] = all_enqueued(worker: PollWorker)
|
|
||||||
PollWorker.perform(job)
|
|
||||||
|
|
||||||
# Ensure updates are streamed out
|
|
||||||
assert called(Pleroma.Web.Streamer.stream(["user", "list", "public", "public:local"], :_))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test "when updated_at is after poll closing" do
|
|
||||||
poll_closed = DateTime.utc_now() |> DateTime.add(-86_400) |> DateTime.to_iso8601()
|
|
||||||
user = insert(:user, local: false)
|
|
||||||
question = insert(:question, user: user, closed: poll_closed)
|
|
||||||
activity = insert(:question_activity, question: question)
|
|
||||||
|
|
||||||
PollWorker.new(%{"op" => "refresh", "activity_id" => activity.id})
|
|
||||||
|> Oban.insert()
|
|
||||||
|
|
||||||
expected_job_args = %{"activity_id" => activity.id, "op" => "refresh"}
|
|
||||||
|
|
||||||
assert_enqueued(args: expected_job_args)
|
|
||||||
|
|
||||||
|
with_mocks([
|
||||||
|
{
|
||||||
|
Pleroma.Web.Streamer,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
stream: fn _, _ -> nil end
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]) do
|
||||||
[job] = all_enqueued(worker: PollWorker)
|
[job] = all_enqueued(worker: PollWorker)
|
||||||
assert {:cancel, :poll_finalized} == PollWorker.perform(job)
|
PollWorker.perform(job)
|
||||||
|
|
||||||
|
# Ensure updates are streamed out
|
||||||
|
assert called(Pleroma.Web.Streamer.stream(["user", "list", "public", "public:local"], :_))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue