RichMedia Backfill: Add cachex positive test
This commit is contained in:
parent
1a83b1d28d
commit
94a28d1286
1 changed files with 22 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue