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.Workers.PublisherWorkerTest do
6 use Pleroma.DataCase, async: true
7 use Oban.Testing, repo: Pleroma.Repo
12 alias Pleroma.Web.ActivityPub.ActivityPub
13 alias Pleroma.Web.ActivityPub.Builder
14 alias Pleroma.Web.CommonAPI
15 alias Pleroma.Web.Federator
17 describe "Oban job priority:" do
21 {:ok, post} = CommonAPI.post(user, %{status: "Regrettable post"})
22 object = Object.normalize(post, fetch: false)
23 {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
24 {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
32 test "Deletions are lower priority", %{delete: delete} do
33 assert {:ok, %Oban.Job{priority: 3}} = Federator.publish(delete)
36 test "Creates are normal priority", %{post: post} do
37 assert {:ok, %Oban.Job{priority: 0}} = Federator.publish(post)