RichMedia Backfill: Add cachex positive test

This commit is contained in:
Phantasm 2026-05-16 00:31:02 +02:00
commit 94a28d1286
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8

View file

@ -23,4 +23,26 @@ defmodule Pleroma.Web.RichMedia.BackfillTest do
Backfill.run(%{"url" => url})
end
test "sets a warm_cache entry" do
url = "https://good.example.com/"
url_hash = Card.url_to_hash(url)
Tesla.Mock.mock(fn %{url: ^url} ->
{:ok,
%Tesla.Env{
status: 200,
body: "<head><meta name=\"twitter:title\" content=\"Cofe\"></head>"
}}
end)
Pleroma.CachexMock
|> expect(:put, fn :rich_media_cache,
^url_hash,
%Pleroma.Web.RichMedia.Card{url_hash: ^url_hash} ->
{:ok, true}
end)
Backfill.run(%{"url" => url})
end
end