diff options
| author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-07-02 05:47:18 +0200 |
|---|---|---|
| committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-07-15 12:32:43 +0200 |
| commit | 922ca232988b90b7a4fb5918bb76c383c90fd770 (patch) | |
| tree | 4e9e33c3e10744d331b56fa4f6b1e30d410be104 /test/web/activity_pub | |
| parent | bfe2dafd398114240fcc2d3472799d6770904f6a (diff) | |
| download | pleroma-922ca232988b90b7a4fb5918bb76c383c90fd770.tar.gz pleroma-922ca232988b90b7a4fb5918bb76c383c90fd770.zip | |
Question: Add tests on HTML tags in options
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/1362
Diffstat (limited to 'test/web/activity_pub')
| -rw-r--r-- | test/web/activity_pub/transmogrifier/question_handling_test.exs | 35 |
1 files changed, 35 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 b7b9a1a7b..fba8106b5 100644 --- a/test/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/web/activity_pub/transmogrifier/question_handling_test.exs @@ -55,6 +55,41 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do ]) end + test "Mastodon Question activity with HTML tags in plaintext" do + options = [ + %{ + "type" => "Note", + "name" => "<input type=\"date\">", + "replies" => %{"totalItems" => 0, "type" => "Collection"} + }, + %{ + "type" => "Note", + "name" => "<input type=\"date\"/>", + "replies" => %{"totalItems" => 0, "type" => "Collection"} + }, + %{ + "type" => "Note", + "name" => "<input type=\"date\" />", + "replies" => %{"totalItems" => 1, "type" => "Collection"} + }, + %{ + "type" => "Note", + "name" => "<input type=\"date\"></input>", + "replies" => %{"totalItems" => 1, "type" => "Collection"} + } + ] + + data = + File.read!("test/fixtures/mastodon-question-activity.json") + |> Poison.decode!() + |> Kernel.put_in(["object", "oneOf"], options) + + {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) + object = Object.normalize(activity, false) + + assert Enum.sort(object.data["oneOf"]) == Enum.sort(options) + end + test "returns an error if received a second time" do data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!() |
