diff options
author | lain <lain@soykaf.club> | 2019-04-05 22:19:37 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-04-05 22:19:37 +0200 |
commit | d79a59c3b8646f2e760eaf59596762d88dcf01c2 (patch) | |
tree | 148f18347e60c97f425608c6d23147769c12c839 | |
parent | 337ea3e107a28df6465f1766655bd6d32342a711 (diff) | |
download | pleroma-d79a59c3b8646f2e760eaf59596762d88dcf01c2.tar.gz |
Add test.
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index 2106253f2..52adab74f 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -68,11 +68,13 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do end test "a note activity" do - note = insert(:note_activity) - user = User.get_cached_by_ap_id(note.data["actor"]) + user = insert(:user) + {:ok, note} = CommonAPI.post(user, %{"status" => "cool test :firefox: #yeah", "spoiler_text" => "<script>alert('alerta')</script>test"}) status = StatusView.render("status.json", %{activity: note}) + user = User.get_cached_by_ap_id(user.ap_id) + created_at = (note.data["object"]["published"] || "") |> String.replace(~r/\.\d+Z/, ".000Z") @@ -86,7 +88,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do in_reply_to_account_id: nil, card: nil, reblog: nil, - content: HtmlSanitizeEx.basic_html(note.data["object"]["content"]), + content: "cool test :firefox: <a class=\"hashtag\" data-tag=\"yeah\" href=\"http://localhost:4001/tag/yeah\">#yeah</a>", created_at: created_at, reblogs_count: 0, replies_count: 0, @@ -97,10 +99,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do muted: false, pinned: false, sensitive: false, - spoiler_text: note.data["object"]["summary"], + spoiler_text: "test", visibility: "public", media_attachments: [], - mentions: [], + mentions: [AccountView.render("mention.json", %{user: user})], tags: [ %{ name: "#{note.data["object"]["tag"]}", @@ -114,10 +116,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do language: nil, emojis: [ %{ - shortcode: "2hu", - url: "corndog.png", - static_url: "corndog.png", - visible_in_picker: false + visible_in_picker: false, + shortcode: "firefox", + static_url: "http://localhost:4001/emoji/Firefox.gif", + url: "http://localhost:4001/emoji/Firefox.gif" } ] } |