1 defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
4 alias Pleroma.Web.MastodonAPI.AccountView
7 test "Represent a user account" do
8 user = insert(:user, %{info: %{"note_count" => 5, "follower_count" => 3}, nickname: "shp@shitposter.club", inserted_at: ~N[2017-08-15 15:47:06.597036]})
11 id: to_string(user.id),
14 display_name: user.name,
16 created_at: "2017-08-15T15:47:06.000Z",
22 avatar: "http://localhost:4001/static/avi.png",
23 avatar_static: "http://localhost:4001/static/avi.png",
24 header: "http://localhost:4001/static/banner.png",
25 header_static: "http://localhost:4001/static/banner.png",
33 assert expected == AccountView.render("account.json", %{user: user})
36 test "Represent a smaller mention" do
40 id: to_string(user.id),
42 username: user.nickname,
46 assert expected == AccountView.render("mention.json", %{user: user})
49 test "represent a relationship" do
51 other_user = insert(:user)
53 {:ok, user} = User.follow(user, other_user)
54 {:ok, user} = User.block(user, other_user)
57 id: to_string(other_user.id),
63 domain_blocking: false
66 assert expected == AccountView.render("relationship.json", %{user: user, target: other_user})