aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-25 15:08:43 +0200
committerlain <lain@soykaf.club>2020-05-25 15:08:43 +0200
commit6bd7070b00a8d0ac64292f4c7152b71bee5f6b69 (patch)
tree476f6595ba49b61114a4bd787938ce0cdac54ca4 /test
parent5fef40520819bea1effab5ed4937613d8896a453 (diff)
downloadpleroma-6bd7070b00a8d0ac64292f4c7152b71bee5f6b69.tar.gz
Transmogrifier: Use a simpler way to get mentions.
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs33
1 files changed, 19 insertions, 14 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index 356004d48..94d8552e8 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -1094,23 +1094,28 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
{:ok, activity} =
CommonAPI.post(user, %{status: "hey, @#{other_user.nickname}, how are ya? #2hu"})
- {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
- object = modified["object"]
+ with_mock Pleroma.Notification,
+ get_notified_from_activity: fn _, _ -> [] end do
+ {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
- expected_mention = %{
- "href" => other_user.ap_id,
- "name" => "@#{other_user.nickname}",
- "type" => "Mention"
- }
+ object = modified["object"]
- expected_tag = %{
- "href" => Pleroma.Web.Endpoint.url() <> "/tags/2hu",
- "type" => "Hashtag",
- "name" => "#2hu"
- }
+ expected_mention = %{
+ "href" => other_user.ap_id,
+ "name" => "@#{other_user.nickname}",
+ "type" => "Mention"
+ }
- assert Enum.member?(object["tag"], expected_tag)
- assert Enum.member?(object["tag"], expected_mention)
+ expected_tag = %{
+ "href" => Pleroma.Web.Endpoint.url() <> "/tags/2hu",
+ "type" => "Hashtag",
+ "name" => "#2hu"
+ }
+
+ refute called(Pleroma.Notification.get_notified_from_activity(:_, :_))
+ assert Enum.member?(object["tag"], expected_tag)
+ assert Enum.member?(object["tag"], expected_mention)
+ end
end
test "it adds the sensitive property" do