Add test.
This commit is contained in:
parent
337ea3e107
commit
d79a59c3b8
|
@ -68,11 +68,13 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "a note activity" do
|
test "a note activity" do
|
||||||
note = insert(:note_activity)
|
user = insert(:user)
|
||||||
user = User.get_cached_by_ap_id(note.data["actor"])
|
{:ok, note} = CommonAPI.post(user, %{"status" => "cool test :firefox: #yeah", "spoiler_text" => "<script>alert('alerta')</script>test"})
|
||||||
|
|
||||||
status = StatusView.render("status.json", %{activity: note})
|
status = StatusView.render("status.json", %{activity: note})
|
||||||
|
|
||||||
|
user = User.get_cached_by_ap_id(user.ap_id)
|
||||||
|
|
||||||
created_at =
|
created_at =
|
||||||
(note.data["object"]["published"] || "")
|
(note.data["object"]["published"] || "")
|
||||||
|> String.replace(~r/\.\d+Z/, ".000Z")
|
|> String.replace(~r/\.\d+Z/, ".000Z")
|
||||||
|
@ -86,7 +88,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
in_reply_to_account_id: nil,
|
in_reply_to_account_id: nil,
|
||||||
card: nil,
|
card: nil,
|
||||||
reblog: 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,
|
created_at: created_at,
|
||||||
reblogs_count: 0,
|
reblogs_count: 0,
|
||||||
replies_count: 0,
|
replies_count: 0,
|
||||||
|
@ -97,10 +99,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
muted: false,
|
muted: false,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
spoiler_text: note.data["object"]["summary"],
|
spoiler_text: "test",
|
||||||
visibility: "public",
|
visibility: "public",
|
||||||
media_attachments: [],
|
media_attachments: [],
|
||||||
mentions: [],
|
mentions: [AccountView.render("mention.json", %{user: user})],
|
||||||
tags: [
|
tags: [
|
||||||
%{
|
%{
|
||||||
name: "#{note.data["object"]["tag"]}",
|
name: "#{note.data["object"]["tag"]}",
|
||||||
|
@ -114,10 +116,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
language: nil,
|
language: nil,
|
||||||
emojis: [
|
emojis: [
|
||||||
%{
|
%{
|
||||||
shortcode: "2hu",
|
visible_in_picker: false,
|
||||||
url: "corndog.png",
|
shortcode: "firefox",
|
||||||
static_url: "corndog.png",
|
static_url: "http://localhost:4001/emoji/Firefox.gif",
|
||||||
visible_in_picker: false
|
url: "http://localhost:4001/emoji/Firefox.gif"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue