summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_test.exs
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@gmail.com>2019-04-20 19:43:06 +0700
committerRoman Chvanikov <chvanikoff@gmail.com>2019-04-20 19:43:06 +0700
commit60f213bb1a6b1627cd8f6bf2903a42c3f3827f1a (patch)
tree297f8ad25104db162b4431f887bb23b3e22255e2 /test/web/common_api/common_api_test.exs
parent05cdb2f2389376081973d96b32e876d2a032d1f1 (diff)
parent6ca82c18a738205483dbbef2fd4de662d70227fb (diff)
downloadpleroma-60f213bb1a6b1627cd8f6bf2903a42c3f3827f1a.tar.gz
pleroma-60f213bb1a6b1627cd8f6bf2903a42c3f3827f1a.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/digest-email
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r--test/web/common_api/common_api_test.exs17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 34aa5bf18..3d2bb8929 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -5,6 +5,7 @@
defmodule Pleroma.Web.CommonAPITest do
use Pleroma.DataCase
alias Pleroma.Activity
+ alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.CommonAPI
@@ -32,14 +33,16 @@ 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
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => ":moominmamma:"})
- assert activity.data["object"]["emoji"]["moominmamma"]
+ assert Object.normalize(activity).data["emoji"]["moominmamma"]
end
test "it adds emoji when updating profiles" do
@@ -64,8 +67,9 @@ defmodule Pleroma.Web.CommonAPITest 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
@@ -79,8 +83,9 @@ defmodule Pleroma.Web.CommonAPITest 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