diff options
author | lain <lain@soykaf.club> | 2019-05-01 18:40:41 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-05-01 18:40:41 +0200 |
commit | 45f790becc2cc63ac000c6432fe8c84e0b589822 (patch) | |
tree | 724d0e8ce5f10807cc25efc2434454bf38c5a52c /test/web/common_api/common_api_test.exs | |
parent | 4908e0eeee2ecb58b204198c20720d52548b6f4a (diff) | |
parent | d107919b3d8b2275ddb7b17846cab182682098a7 (diff) | |
download | pleroma-45f790becc2cc63ac000c6432fe8c84e0b589822.tar.gz |
Merge remote-tracking branch 'origin/develop' into conversations_three
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 34aa5bf18..a5b07c446 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,24 +33,26 @@ 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:"}) + {:ok, activity} = CommonAPI.post(user, %{"status" => ":firefox:"}) - assert activity.data["object"]["emoji"]["moominmamma"] + assert Object.normalize(activity).data["emoji"]["firefox"] end test "it adds emoji when updating profiles" do - user = insert(:user, %{name: ":karjalanpiirakka:"}) + user = insert(:user, %{name: ":firefox:"}) CommonAPI.update(user) user = User.get_cached_by_ap_id(user.ap_id) - [karjalanpiirakka] = user.info.source_data["tag"] + [firefox] = user.info.source_data["tag"] - assert karjalanpiirakka["name"] == ":karjalanpiirakka:" + assert firefox["name"] == ":firefox:" end describe "posting" 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 |