X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Foban_helpers.ex;h=e96994c5760e1ad2f3a1830df8bf249e670429c4;hb=8a383707ae143ba47fa1ba68da20bc6bec425126;hp=54b5a95662314a943fa0eecf9e34551235e310f9;hpb=267262491ecf7b413052708062abac69b1d8f643;p=akkoma
diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex
index 54b5a9566..e96994c57 100644
--- a/test/support/oban_helpers.ex
+++ b/test/support/oban_helpers.ex
@@ -1,16 +1,26 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.ObanHelpers do
+defmodule Pleroma.Tests.ObanHelpers do
@moduledoc """
Oban test helpers.
"""
alias Pleroma.Repo
+ def wipe_all do
+ Repo.delete_all(Oban.Job)
+ end
+
+ def perform_all do
+ Oban.Job
+ |> Repo.all()
+ |> perform()
+ end
+
def perform(%Oban.Job{} = job) do
- res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job])
+ res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job.args, job])
Repo.delete(job)
res
end