Twitter API: Add tests for nil names.

This commit is contained in:
scarlett 2018-11-12 16:40:34 +00:00
parent cb6fd73861
commit db78c72868

View file

@ -13,6 +13,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
[user: user]
end
test "A user with only a nickname", %{user: user} do
user = %{user | name: nil, nickname: "scarlett@catgirl.science"}
represented = UserView.render("show.json", %{user: user})
assert represented["name"] == user.nickname
assert represented["name_html"] == user.nickname
end
test "A user with an avatar object", %{user: user} do
image = "image"
user = %{user | avatar: %{"url" => [%{"href" => image}]}}