aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-03-02 12:22:02 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-03-04 18:31:49 +0000
commit9f3cb38012281c596d1aa8c479f07362fa58dacb (patch)
tree9d5d7f10e7a0fa196ad079da7be5f0fba860756e /test
parentd7a278a733616d01ee41c3923a3d87730c685879 (diff)
downloadpleroma-9f3cb38012281c596d1aa8c479f07362fa58dacb.tar.gz
helpers: use AutoLinker to validate URIs as well as the other tests
Diffstat (limited to 'test')
-rw-r--r--test/web/rich_media/helpers_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/rich_media/helpers_test.exs b/test/web/rich_media/helpers_test.exs
index 9285f078d..60d93768f 100644
--- a/test/web/rich_media/helpers_test.exs
+++ b/test/web/rich_media/helpers_test.exs
@@ -20,7 +20,27 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
"content_type" => "text/markdown"
})
+ Pleroma.Config.put([:rich_media, :enabled], true)
+
+ assert %{} == Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
+
+ Pleroma.Config.put([:rich_media, :enabled], false)
+ end
+
+ test "refuses to crawl malformed URLs" do
+ user = insert(:user)
+
+ {:ok, activity} =
+ CommonAPI.post(user, %{
+ "status" => "[test](example.com[]/ogp)",
+ "content_type" => "text/markdown"
+ })
+
+ Pleroma.Config.put([:rich_media, :enabled], true)
+
assert %{} == Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
+
+ Pleroma.Config.put([:rich_media, :enabled], false)
end
test "crawls valid, complete URLs" do