Fixes for default disabled rich media in test environment
Also add a test to validate the correct error when disabled
This commit is contained in:
parent
65c8763907
commit
49156f0183
@ -13,6 +13,8 @@ defmodule Pleroma.Web.RichMedia.ParserTest do
|
|||||||
mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
setup_all do: clear_config([:rich_media, :enabled], true)
|
||||||
|
|
||||||
test "returns error when no metadata present" do
|
test "returns error when no metadata present" do
|
||||||
assert {:error, _} = Parser.parse("https://example.com/empty")
|
assert {:error, _} = Parser.parse("https://example.com/empty")
|
||||||
end
|
end
|
||||||
@ -127,4 +129,10 @@ defmodule Pleroma.Web.RichMedia.ParserTest do
|
|||||||
assert :error == Parser.parse(url)
|
assert :error == Parser.parse(url)
|
||||||
end)
|
end)
|
||||||
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
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user