diff options
author | Mark Felder <feld@feld.me> | 2024-02-04 19:24:52 -0500 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-02-04 23:47:04 -0500 |
commit | 04fc4eddaa534185d9784351e70f59f30bc1476f (patch) | |
tree | 42015621618cb00b765b562af8dacb4e4b0dacf0 /test/support/http_request_mock.ex | |
parent | 0b9990a7e53061439a7fa9dbe3e39e3ee22d1371 (diff) | |
download | pleroma-04fc4eddaa534185d9784351e70f59f30bc1476f.tar.gz pleroma-04fc4eddaa534185d9784351e70f59f30bc1476f.zip |
Fix Rich Media Previews for updated activities
The Rich Media Previews were not regenerated when a post was updated due to a cache invalidation issue. They are now cached by the activity id so they can be evicted with the other activity cache objects in the :scrubber_cache.
Diffstat (limited to 'test/support/http_request_mock.ex')
-rw-r--r-- | test/support/http_request_mock.ex | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index f76128312..b220fd051 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1464,6 +1464,14 @@ defmodule HttpRequestMock do }} end + def get("https://google.com/", _, _, _) do + {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/google.html")}} + end + + def get("https://yahoo.com/", _, _, _) do + {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/yahoo.html")}} + end + def get(url, query, body, headers) do {:error, "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"} @@ -1539,7 +1547,9 @@ defmodule HttpRequestMock do @rich_media_mocks [ "https://example.com/ogp", "https://example.com/ogp-missing-data", - "https://example.com/twitter-card" + "https://example.com/twitter-card", + "https://google.com/", + "https://yahoo.com/" ] def head(url, _query, _body, _headers) when url in @rich_media_mocks do {:ok, %Tesla.Env{status: 404, body: ""}} |