aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2022-07-28 04:46:15 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2022-07-28 04:46:15 +0000
commit0814d0e0cb11ef82809babe34e4842f6c5676d70 (patch)
treef7ef18868582f8b650b41875b4bb6b80ec91670b /test
parent0f9f3d28970d0a4c86184d60166712ce605f7713 (diff)
parent7167de592e3523459a1eb65d902085e828f962b2 (diff)
downloadpleroma-0814d0e0cb11ef82809babe34e4842f6c5676d70.tar.gz
Merge branch 'fix/proper-emoji-qualification' into 'develop'
Emoji: implement full-qualifier using combinations See merge request pleroma/pleroma!3709
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/emoji-reaction-unqualified.json30
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs13
2 files changed, 9 insertions, 34 deletions
diff --git a/test/fixtures/emoji-reaction-unqualified.json b/test/fixtures/emoji-reaction-unqualified.json
deleted file mode 100644
index 722fd7092..000000000
--- a/test/fixtures/emoji-reaction-unqualified.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "type": "EmojiReact",
- "signature": {
- "type": "RsaSignature2017",
- "signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
- "creator": "http://mastodon.example.org/users/admin#main-key",
- "created": "2018-02-17T18:57:49Z"
- },
- "object": "http://localtesting.pleroma.lol/objects/eb92579d-3417-42a8-8652-2492c2d4f454",
- "content": "❤",
- "nickname": "lain",
- "id": "http://mastodon.example.org/users/admin#reactions/2",
- "actor": "http://mastodon.example.org/users/admin",
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- "https://w3id.org/security/v1",
- {
- "toot": "http://joinmastodon.org/ns#",
- "sensitive": "as:sensitive",
- "ostatus": "http://ostatus.org#",
- "movedTo": "as:movedTo",
- "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
- "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
- "conversation": "ostatus:conversation",
- "atomUri": "ostatus:atomUri",
- "Hashtag": "as:Hashtag",
- "Emoji": "toot:Emoji"
- }
- ]
-}
diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
index 41d96fa66..9d99df27c 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
@@ -42,11 +42,15 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do
other_user = insert(:user, local: false)
{:ok, activity} = CommonAPI.post(user, %{status: "hello"})
+ # woman detective emoji, unqualified
+ unqualified_emoji = [0x1F575, 0x200D, 0x2640] |> List.to_string()
+
data =
- File.read!("test/fixtures/emoji-reaction-unqualified.json")
+ File.read!("test/fixtures/emoji-reaction.json")
|> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
+ |> Map.put("content", unqualified_emoji)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
@@ -54,13 +58,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do
assert data["type"] == "EmojiReact"
assert data["id"] == "http://mastodon.example.org/users/admin#reactions/2"
assert data["object"] == activity.data["object"]
- # heart emoji with added emoji variation sequence
- assert data["content"] == "❤\uFE0F"
+ # woman detective emoji, fully qualified
+ emoji = [0x1F575, 0xFE0F, 0x200D, 0x2640, 0xFE0F] |> List.to_string()
+ assert data["content"] == emoji
object = Object.get_by_ap_id(data["object"])
assert object.data["reaction_count"] == 1
- assert match?([["❤\uFE0F", _]], object.data["reactions"])
+ assert match?([[emoji, _]], object.data["reactions"])
end
test "it reject invalid emoji reactions" do