1 defmodule Pleroma.Web.TwitterAPI.Representers.UserRepresenterTest do
5 alias Pleroma.Web.TwitterAPI.Representers.UserRepresenter
6 alias Pleroma.Builders.UserBuilder
9 {:ok, user} = UserBuilder.insert
13 test "A user", %{user: user} do
14 image = "https://placehold.it/48x48"
18 "screen_name" => user.nickname,
19 "description" => user.bio,
21 "favourites_count" => 0,
22 "statuses_count" => 0,
24 "followers_count" => 0,
25 "profile_image_url" => image,
26 "profile_image_url_https" => image,
27 "profile_image_url_profile_size" => image,
28 "profile_image_url_original" => image,
33 assert represented == UserRepresenter.to_map(user)
36 test "A user for a given other follower", %{user: user} do
37 {:ok, follower} = UserBuilder.insert(%{following: [User.ap_followers(user)]})
38 image = "https://placehold.it/48x48"
42 "screen_name" => user.nickname,
43 "description" => user.bio,
45 "favourites_count" => 0,
46 "statuses_count" => 0,
48 "followers_count" => 0,
49 "profile_image_url" => image,
50 "profile_image_url_https" => image,
51 "profile_image_url_profile_size" => image,
52 "profile_image_url_original" => image,
57 assert represented == UserRepresenter.to_map(user, %{for: follower})