diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-11-17 16:18:40 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2019-01-20 02:27:48 +0000 |
commit | 21ac35fcc0a531914cc3f84ace89f6cf029cfa6c (patch) | |
tree | 01f0771eee3903df03217287bfcc8cd7367dab88 | |
parent | 681f40ee5c4de644c79f71bb6671c4c63b18e68a (diff) | |
download | pleroma-21ac35fcc0a531914cc3f84ace89f6cf029cfa6c.tar.gz |
tests: add tests for DM sanitizer
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 6107ac4f7..5aa136e65 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -162,6 +162,36 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert data["object"]["url"] == "https://prismo.news/posts/83" end + test "it cleans up incoming notices which are not really DMs" do + user = insert(:user) + other_user = insert(:user) + + to = [user.ap_id, other_user.ap_id] + + data = + File.read!("test/fixtures/mastodon-post-activity.json") + |> Poison.decode!() + |> Map.put("to", to) + |> Map.put("cc", []) + + object = + data["object"] + |> Map.put("to", to) + |> Map.put("cc", []) + + data = Map.put(data, "object", object) + + {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) + + assert data["to"] == [] + assert data["cc"] == to + + object = data["object"] + + assert object["to"] == [] + assert object["cc"] == to + end + test "it works for incoming follow requests" do user = insert(:user) |