logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 49156f0183524f13a1363d17b2220718405ea5b6
parent 65c8763907e28a12bc0a4c1269b5a765006d65b2
Author: Mark Felder <feld@feld.me>
Date:   Fri,  7 Jun 2024 13:31:32 -0400

Fixes for default disabled rich media in test environment

Also add a test to validate the correct error when disabled

Diffstat:

Mtest/pleroma/web/rich_media/parser_test.exs8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/test/pleroma/web/rich_media/parser_test.exs b/test/pleroma/web/rich_media/parser_test.exs @@ -13,6 +13,8 @@ defmodule Pleroma.Web.RichMedia.ParserTest do mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) end + setup_all do: clear_config([:rich_media, :enabled], true) + test "returns error when no metadata present" do assert {:error, _} = Parser.parse("https://example.com/empty") end @@ -127,4 +129,10 @@ defmodule Pleroma.Web.RichMedia.ParserTest do assert :error == Parser.parse(url) end) end + + test "returns error when disabled" do + clear_config([:rich_media, :enabled], false) + + assert match?({:error, :rich_media_disabled}, Parser.parse("https://example.com/ogp")) + end end