1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Tests.ObanHelpers do
15 Repo.delete_all(Oban.Job)
20 |> Ecto.Query.where(state: "available")
25 def perform(%Oban.Job{} = job) do
26 res = apply(String.to_existing_atom("Elixir." <> job.worker), :perform, [job])
31 def perform(jobs) when is_list(jobs) do
32 for job <- jobs, do: perform(job)
35 def member?(%{} = job_args, jobs) when is_list(jobs) do
36 Enum.any?(jobs, fn job ->
37 member?(job_args, job.args)
41 def member?(%{} = test_attrs, %{} = attrs) do
44 fn {k, _v} -> member?(test_attrs[k], attrs[k]) end
48 def member?(x, y), do: x == y