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 inserted_at: ~N[2017-08-15 15:47:06.597036]
27 id: to_string(user.id),
30 display_name: user.name,
32 created_at: "2017-08-15T15:47:06.000Z",
38 avatar: "http://localhost:4001/images/avi.png",
39 avatar_static: "http://localhost:4001/images/avi.png",
40 header: "http://localhost:4001/images/banner.png",
41 header_static: "http://localhost:4001/images/banner.png",
44 "static_url" => "/file.png",
46 "shortcode" => "karjalanpiirakka",
47 "visible_in_picker" => false
58 assert expected == AccountView.render("account.json", %{user: user})
61 test "Represent a smaller mention" do
65 id: to_string(user.id),
67 username: user.nickname,
71 assert expected == AccountView.render("mention.json", %{user: user})
74 test "represent a relationship" do
76 other_user = insert(:user)
78 {:ok, user} = User.follow(user, other_user)
79 {:ok, user} = User.block(user, other_user)
82 id: to_string(other_user.id),
88 domain_blocking: false
91 assert expected == AccountView.render("relationship.json", %{user: user, target: other_user})