From: Haelwenn (lanodan) Monnier Date: Fri, 28 Sep 2018 09:17:33 +0000 (+0200) Subject: [Pleroma.Web.TwitterAPI.UserViewTest]: Add test for mastodon-fields X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a74daabfae5ed149942b5afc64982d3e2ca95b11;p=akkoma [Pleroma.Web.TwitterAPI.UserViewTest]: Add test for mastodon-fields --- diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 383d7d34c..2deb22fb1 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -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