1 defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
4 alias Pleroma.Web.MastodonAPI.AccountView
7 test "Represent a user account" do
12 "icon" => %{"url" => "/file.png"},
13 "name" => ":karjalanpiirakka:"
20 info: %{note_count: 5, follower_count: 3, source_data: source_data},
21 nickname: "shp@shitposter.club",
22 name: ":karjalanpiirakka: shp",
23 bio: "<script src=\"invalid-html\"></script><span>valid html</span>",
24 inserted_at: ~N[2017-08-15 15:47:06.597036]
28 id: to_string(user.id),
31 display_name: user.name,
33 created_at: "2017-08-15T15:47:06.000Z",
37 note: "<span>valid html</span>",
39 avatar: "http://localhost:4001/images/avi.png",
40 avatar_static: "http://localhost:4001/images/avi.png",
41 header: "http://localhost:4001/images/banner.png",
42 header_static: "http://localhost:4001/images/banner.png",
45 "static_url" => "/file.png",
47 "shortcode" => "karjalanpiirakka",
48 "visible_in_picker" => false
59 confirmation_pending: false,
64 assert expected == AccountView.render("account.json", %{user: user})
67 test "Represent a Service(bot) account" do
70 info: %{note_count: 5, follower_count: 3, source_data: %{"type" => "Service"}},
71 nickname: "shp@shitposter.club",
72 inserted_at: ~N[2017-08-15 15:47:06.597036]
76 id: to_string(user.id),
79 display_name: user.name,
81 created_at: "2017-08-15T15:47:06.000Z",
87 avatar: "http://localhost:4001/images/avi.png",
88 avatar_static: "http://localhost:4001/images/avi.png",
89 header: "http://localhost:4001/images/banner.png",
90 header_static: "http://localhost:4001/images/banner.png",
100 confirmation_pending: false,
105 assert expected == AccountView.render("account.json", %{user: user})
108 test "Represent a smaller mention" do
112 id: to_string(user.id),
114 username: user.nickname,
118 assert expected == AccountView.render("mention.json", %{user: user})
121 test "represent a relationship" do
123 other_user = insert(:user)
125 {:ok, user} = User.follow(user, other_user)
126 {:ok, user} = User.block(user, other_user)
129 id: to_string(other_user.id),
134 muting_notifications: false,
136 domain_blocking: false,
137 showing_reblogs: false,
141 assert expected == AccountView.render("relationship.json", %{user: user, target: other_user})