X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Frich_media%2Fhelpers_test.exs;h=60d93768f20f5b1fd5cd968b12a279d64d770e34;hb=cbdd11c38111fd7c195983f40265b675e1201d4e;hp=9285f078d3063916fd67646cb5eab9d8dc11df82;hpb=d7a278a733616d01ee41c3923a3d87730c685879;p=akkoma 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