From e2e66e50d3066d48d8ef9200e7d221f5aeec4c44 Mon Sep 17 00:00:00 2001 From: lain Date: Thu, 30 Jul 2020 14:29:00 +0200 Subject: [PATCH] SimplePolicyTest: Add test for leaking DMs. --- test/web/activity_pub/mrf/simple_policy_test.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/web/activity_pub/mrf/simple_policy_test.exs b/test/web/activity_pub/mrf/simple_policy_test.exs index c0e82731b..9a1a7bdc8 100644 --- a/test/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/web/activity_pub/mrf/simple_policy_test.exs @@ -290,6 +290,15 @@ test "has a matching host" do "cc" => [actor.follower_address, "http://foo.bar/qux"] } + dm_activity = %{ + "actor" => actor.ap_id, + "to" => [ + following_user.ap_id, + non_following_user.ap_id + ], + "cc" => [] + } + actor_domain = activity |> Map.fetch!("actor") @@ -305,6 +314,10 @@ test "has a matching host" do refute "https://www.w3.org/ns/activitystreams#Public" in new_activity["cc"] refute non_following_user.ap_id in new_activity["to"] refute non_following_user.ap_id in new_activity["cc"] + + assert {:ok, new_dm_activity} = SimplePolicy.filter(dm_activity) + assert new_dm_activity["to"] == [following_user.ap_id] + assert new_dm_activity["cc"] == [] end end