logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: a9bea02fe92c7b134020c24b4aef09d2e9ab776c
parent 93eb458c24ca534ac43de03ea845a3ea24605f7e
Author: feld <feld@feld.me>
Date:   Mon, 24 Jun 2024 02:05:41 +0000

Merge branch 'oban/richmedia-stream' into 'develop'

Add test validating the activity_id is correctly present in the Oban job

See merge request pleroma/pleroma!4159

Diffstat:

Achangelog.d/rich_media_oban.skip0
Mlib/pleroma/web/rich_media/card.ex2+-
Mtest/pleroma/web/rich_media/card_test.exs7+++++++
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/changelog.d/rich_media_oban.skip b/changelog.d/rich_media_oban.skip diff --git a/lib/pleroma/web/rich_media/card.ex b/lib/pleroma/web/rich_media/card.ex @@ -83,7 +83,7 @@ defmodule Pleroma.Web.RichMedia.Card do card nil -> - activity_id = Keyword.get(opts, :activity, nil) + activity_id = Keyword.get(opts, :activity_id, nil) RichMediaWorker.new(%{"op" => "backfill", "url" => url, "activity_id" => activity_id}) |> Oban.insert() diff --git a/test/pleroma/web/rich_media/card_test.exs b/test/pleroma/web/rich_media/card_test.exs @@ -3,12 +3,14 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.CardTest do + use Oban.Testing, repo: Pleroma.Repo use Pleroma.DataCase, async: true alias Pleroma.Tests.ObanHelpers alias Pleroma.UnstubbedConfigMock, as: ConfigMock alias Pleroma.Web.CommonAPI alias Pleroma.Web.RichMedia.Card + alias Pleroma.Workers.RichMediaWorker import Mox import Pleroma.Factory @@ -37,6 +39,11 @@ defmodule Pleroma.Web.RichMedia.CardTest do content_type: "text/markdown" }) + assert_enqueued( + worker: RichMediaWorker, + args: %{"url" => url, "activity_id" => activity.id} + ) + ObanHelpers.perform_all() assert %Card{url_hash: ^url_hash, fields: _} = Card.get_by_activity(activity)