[Pleroma.Web.TwitterAPI.UserViewTest]: Add test for mastodon-fields

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-09-28 11:17:33 +02:00
parent 82b57ebad1
commit a74daabfae
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE

View File

@ -227,4 +227,30 @@ test "A blocked user for the blocker" do
blocker = Repo.get(User, blocker.id) blocker = Repo.get(User, blocker.id)
assert represented == UserView.render("show.json", %{user: user, for: blocker}) assert represented == UserView.render("show.json", %{user: user, for: blocker})
end end
test "a user with mastodon fields" do
fields = [
%{
"name" => "Pronouns",
"value" => "she/her"
},
%{
"name" => "Website",
"value" => "https://example.org/"
}
]
user =
insert(:user, %{
info: %{
"source_data" => %{
"attachment" =>
Enum.map(fields, fn field -> Map.put(field, "type", "PropertyValue") end)
}
}
})
userview = UserView.render("show.json", %{user: user})
assert userview["fields"] == fields
end
end end