mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-27 00:09:35 +00:00
[Pleroma.Web.TwitterAPI.UserViewTest]: Add test for mastodon-fields
This commit is contained in:
parent
82b57ebad1
commit
a74daabfae
|
@ -227,4 +227,30 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
blocker = Repo.get(User, blocker.id)
|
||||
assert represented == UserView.render("show.json", %{user: user, for: blocker})
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue