aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_test.exs
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-11-25 22:31:07 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-12-04 04:52:09 +0000
commit4ca4c83871a6026ba0e4eb148e99b352edbadb5b (patch)
treeb088ce9c40d594aacb6788f83cd83204587ca996 /test/web/common_api/common_api_test.exs
parentcf139e3eec9bf978cfff24044dce5b5c388fa303 (diff)
downloadpleroma-4ca4c83871a6026ba0e4eb148e99b352edbadb5b.tar.gz
tests: fix most remaining failures
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r--test/web/common_api/common_api_test.exs18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 8fc65f4c0..3f81d952c 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -1,7 +1,7 @@
defmodule Pleroma.Web.CommonAPI.Test do
use Pleroma.DataCase
alias Pleroma.Web.CommonAPI
- alias Pleroma.User
+ alias Pleroma.{User, Object}
import Pleroma.Factory
@@ -9,7 +9,9 @@ defmodule Pleroma.Web.CommonAPI.Test 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 when updating profiles" do
@@ -34,8 +36,10 @@ defmodule Pleroma.Web.CommonAPI.Test do
"content_type" => "text/html"
})
- content = activity.data["object"]["content"]
- assert content == "<p><b>2hu</b></p>alert('xss')"
+ object =
+ Object.normalize(activity.data["object"])
+
+ assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
end
test "it filters out obviously bad tags when accepting a post as Markdown" do
@@ -49,8 +53,10 @@ defmodule Pleroma.Web.CommonAPI.Test do
"content_type" => "text/markdown"
})
- content = activity.data["object"]["content"]
- assert content == "<p><b>2hu</b></p>alert('xss')"
+ object =
+ Object.normalize(activity.data["object"])
+
+ assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')"
end
end
end