diff options
author | rinpatch <rinpatch@sdf.org> | 2019-05-18 13:37:38 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-05-18 13:37:38 +0300 |
commit | 5ece901af3e887664653c79c5e61618cc5cf0ecf (patch) | |
tree | 93fc7c3bdb70348d5ef91fa9f7db3293b17f9854 /test/web/rich_media/helpers_test.exs | |
parent | fd920c897339b9cedea042dd6698d14380cedae7 (diff) | |
parent | 8e9a764dfcde315afd055c8e63543bfca24cc41b (diff) | |
download | pleroma-5ece901af3e887664653c79c5e61618cc5cf0ecf.tar.gz pleroma-5ece901af3e887664653c79c5e61618cc5cf0ecf.zip |
Resolve merge conflicts and remove IO.inspects
Diffstat (limited to 'test/web/rich_media/helpers_test.exs')
-rw-r--r-- | test/web/rich_media/helpers_test.exs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/web/rich_media/helpers_test.exs b/test/web/rich_media/helpers_test.exs index 60d93768f..53b0596f5 100644 --- a/test/web/rich_media/helpers_test.exs +++ b/test/web/rich_media/helpers_test.exs @@ -1,6 +1,7 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do use Pleroma.DataCase + alias Pleroma.Object alias Pleroma.Web.CommonAPI import Pleroma.Factory @@ -59,4 +60,43 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do Pleroma.Config.put([:rich_media, :enabled], false) end + + test "refuses to crawl URLs from posts marked sensitive" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "http://example.com/ogp", + "sensitive" => true + }) + + %Object{} = object = Object.normalize(activity) + + assert object.data["sensitive"] + + 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 URLs from posts tagged NSFW" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "http://example.com/ogp #nsfw" + }) + + %Object{} = object = Object.normalize(activity) + + assert object.data["sensitive"] + + 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 end |