Merge remote-tracking branch 'origin/develop' into oban/backup
This commit is contained in:
commit
775f45cfe2
12 changed files with 64 additions and 28 deletions
26
test/pleroma/web/rich_media/backfill_test.exs
Normal file
26
test/pleroma/web/rich_media/backfill_test.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.RichMedia.BackfillTest do
|
||||
use Pleroma.DataCase
|
||||
|
||||
alias Pleroma.Web.RichMedia.Backfill
|
||||
alias Pleroma.Web.RichMedia.Card
|
||||
|
||||
import Mox
|
||||
|
||||
setup_all do: clear_config([:rich_media, :enabled], true)
|
||||
|
||||
test "sets a negative cache entry for an error" do
|
||||
url = "https://bad.example.com/"
|
||||
url_hash = Card.url_to_hash(url)
|
||||
|
||||
Tesla.Mock.mock(fn %{url: ^url} -> :error end)
|
||||
|
||||
Pleroma.CachexMock
|
||||
|> expect(:put, fn :rich_media_cache, ^url_hash, :error, ttl: _ -> {:ok, true} end)
|
||||
|
||||
Backfill.run(%{"url" => url})
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue