Merge branch 'oauth2' into 'develop'
[akkoma] / test / web / mastodon_api / account_view_test.exs
1 defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
2 use Pleroma.DataCase
3 import Pleroma.Factory
4 alias Pleroma.Web.MastodonAPI.AccountView
5
6 test "Represent a user account" do
7 user = insert(:user, %{info: %{"note_count" => 5, "follower_count" => 3}})
8
9 expected = %{
10 id: user.id,
11 username: user.nickname,
12 acct: user.nickname,
13 display_name: user.name,
14 locked: false,
15 created_at: user.inserted_at,
16 followers_count: 3,
17 following_count: 0,
18 statuses_count: 5,
19 note: user.bio,
20 url: user.ap_id,
21 avatar: "https://placehold.it/48x48",
22 avatar_static: "https://placehold.it/48x48",
23 header: "https://placehold.it/700x335",
24 header_static: "https://placehold.it/700x335"
25 }
26
27 assert expected == AccountView.render("account.json", %{user: user})
28 end
29
30 test "Represent a smaller mention" do
31 user = insert(:user)
32
33 expected = %{
34 id: user.id,
35 acct: user.nickname,
36 username: user.nickname,
37 url: user.ap_id
38 }
39
40 assert expected == AccountView.render("mention.json", %{user: user})
41 end
42 end