X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Foban_helpers.ex;h=9b6e5256e54ca7f981a15a240f0c6b0971a06375;hb=85d71d4f1d433a168eb136ad88b651b6c1d1a4fc;hp=72792c0648a89a7f5d9a8df2199dfe74665cf4c5;hpb=b923842e96e821afeb7bbfa0d098b9c5698281c5;p=akkoma
diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex
index 72792c064..9b6e5256e 100644
--- a/test/support/oban_helpers.ex
+++ b/test/support/oban_helpers.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Tests.ObanHelpers do
@@ -7,16 +7,23 @@ defmodule Pleroma.Tests.ObanHelpers do
Oban test helpers.
"""
+ require Ecto.Query
+
alias Pleroma.Repo
+ def wipe_all do
+ Repo.delete_all(Oban.Job)
+ end
+
def perform_all do
Oban.Job
+ |> Ecto.Query.where(state: "available")
|> Repo.all()
|> perform()
end
def perform(%Oban.Job{} = job) do
- res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job.args, job])
+ res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job])
Repo.delete(job)
res
end