Add test validating the activity_id is correctly present in the Oban job
This was preventing the activity from being streamed over websockets.
This commit is contained in:
parent
93eb458c24
commit
634e3d4155
0
changelog.d/rich_media_oban.skip
Normal file
0
changelog.d/rich_media_oban.skip
Normal file
@ -83,7 +83,7 @@ defmodule Pleroma.Web.RichMedia.Card do
|
|||||||
card
|
card
|
||||||
|
|
||||||
nil ->
|
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})
|
RichMediaWorker.new(%{"op" => "backfill", "url" => url, "activity_id" => activity_id})
|
||||||
|> Oban.insert()
|
|> Oban.insert()
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.RichMedia.CardTest do
|
defmodule Pleroma.Web.RichMedia.CardTest do
|
||||||
|
use Oban.Testing, repo: Pleroma.Repo
|
||||||
use Pleroma.DataCase, async: true
|
use Pleroma.DataCase, async: true
|
||||||
|
|
||||||
alias Pleroma.Tests.ObanHelpers
|
alias Pleroma.Tests.ObanHelpers
|
||||||
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.RichMedia.Card
|
alias Pleroma.Web.RichMedia.Card
|
||||||
|
alias Pleroma.Workers.RichMediaWorker
|
||||||
|
|
||||||
import Mox
|
import Mox
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
@ -37,6 +39,11 @@ defmodule Pleroma.Web.RichMedia.CardTest do
|
|||||||
content_type: "text/markdown"
|
content_type: "text/markdown"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
assert_enqueued(
|
||||||
|
worker: RichMediaWorker,
|
||||||
|
args: %{"url" => url, "activity_id" => activity.id}
|
||||||
|
)
|
||||||
|
|
||||||
ObanHelpers.perform_all()
|
ObanHelpers.perform_all()
|
||||||
|
|
||||||
assert %Card{url_hash: ^url_hash, fields: _} = Card.get_by_activity(activity)
|
assert %Card{url_hash: ^url_hash, fields: _} = Card.get_by_activity(activity)
|
||||||
|
Loading…
Reference in New Issue
Block a user