diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-09-03 10:34:06 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2020-09-03 10:34:06 -0500 |
commit | 85446cc30c97a326d90b4ef719ba2e54c2ad423f (patch) | |
tree | caa8e1268cbab2a09e414b85d2ce52b24249d0da /test/web/activity_pub/transmogrifier/question_handling_test.exs | |
parent | 6ce28c409137972ee9b105b9d7ab4a0fd2a0d08b (diff) | |
parent | 9433311923d4b41b057ce6cb1632ff27d46919b4 (diff) | |
download | pleroma-85446cc30c97a326d90b4ef719ba2e54c2ad423f.tar.gz pleroma-85446cc30c97a326d90b4ef719ba2e54c2ad423f.zip |
Merge branch 'develop' into media-preview-proxy
Diffstat (limited to 'test/web/activity_pub/transmogrifier/question_handling_test.exs')
-rw-r--r-- | test/web/activity_pub/transmogrifier/question_handling_test.exs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier/question_handling_test.exs b/test/web/activity_pub/transmogrifier/question_handling_test.exs index c82361828..74ee79543 100644 --- a/test/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/web/activity_pub/transmogrifier/question_handling_test.exs @@ -106,6 +106,57 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do assert Enum.sort(object.data["oneOf"]) == Enum.sort(options) end + test "Mastodon Question activity with custom emojis" do + options = [ + %{ + "type" => "Note", + "name" => ":blobcat:", + "replies" => %{"totalItems" => 0, "type" => "Collection"} + }, + %{ + "type" => "Note", + "name" => ":blobfox:", + "replies" => %{"totalItems" => 0, "type" => "Collection"} + } + ] + + tag = [ + %{ + "icon" => %{ + "type" => "Image", + "url" => "https://blob.cat/emoji/custom/blobcats/blobcat.png" + }, + "id" => "https://blob.cat/emoji/custom/blobcats/blobcat.png", + "name" => ":blobcat:", + "type" => "Emoji", + "updated" => "1970-01-01T00:00:00Z" + }, + %{ + "icon" => %{"type" => "Image", "url" => "https://blob.cat/emoji/blobfox/blobfox.png"}, + "id" => "https://blob.cat/emoji/blobfox/blobfox.png", + "name" => ":blobfox:", + "type" => "Emoji", + "updated" => "1970-01-01T00:00:00Z" + } + ] + + data = + File.read!("test/fixtures/mastodon-question-activity.json") + |> Poison.decode!() + |> Kernel.put_in(["object", "oneOf"], options) + |> Kernel.put_in(["object", "tag"], tag) + + {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) + object = Object.normalize(activity, false) + + assert object.data["oneOf"] == options + + assert object.data["emoji"] == %{ + "blobcat" => "https://blob.cat/emoji/custom/blobcats/blobcat.png", + "blobfox" => "https://blob.cat/emoji/blobfox/blobfox.png" + } + end + test "returns an error if received a second time" do data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!() |