X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fcommon_api%2Fcommon_api_test.exs;h=b9ed088e41c6600f736ed5fa865e2d264df2f356;hb=627e5a0a4992cc19fc65a7e93a09c470c8e2bf33;hp=34aa5bf1884f949c9a8642ffba4a5dc2c07cb6f6;hpb=73df3046e014ae16e03f16a9c82921652cefcb54;p=akkoma diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 34aa5bf18..b9ed088e4 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.CommonAPITest do use Pleroma.DataCase alias Pleroma.Activity alias Pleroma.User + alias Pleroma.Object alias Pleroma.Web.CommonAPI import Pleroma.Factory @@ -32,7 +33,9 @@ defmodule Pleroma.Web.CommonAPITest do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"}) - assert activity.data["object"]["tag"] == ["2hu"] + object = Object.normalize(activity.data["object"]) + + assert object.data["tag"] == ["2hu"] end test "it adds emoji in the object" do @@ -64,8 +67,9 @@ defmodule Pleroma.Web.CommonAPITest do "content_type" => "text/html" }) - content = activity.data["object"]["content"] - assert content == "

2hu

alert('xss')" + object = Object.normalize(activity.data["object"]) + + assert object.data["content"] == "

2hu

alert('xss')" end test "it filters out obviously bad tags when accepting a post as Markdown" do @@ -79,8 +83,9 @@ defmodule Pleroma.Web.CommonAPITest do "content_type" => "text/markdown" }) - content = activity.data["object"]["content"] - assert content == "

2hu

alert('xss')" + object = Object.normalize(activity.data["object"]) + + assert object.data["content"] == "

2hu

alert('xss')" end end