Merge branch 'openapi/follow_requests' into 'develop'
[akkoma] / test / web / mastodon_api / views / account_view_test.exs
index ef3f3eff17f8b3f41d23af0d8d8d5696f97d7668..85fa4f6a27e1a4d924a6e95673c606e5ad4528f3 100644 (file)
@@ -19,16 +19,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
   end
 
   test "Represent a user account" do
-    source_data = %{
-      "tag" => [
-        %{
-          "type" => "Emoji",
-          "icon" => %{"url" => "/file.png"},
-          "name" => ":karjalanpiirakka:"
-        }
-      ]
-    }
-
     background_image = %{
       "url" => [%{"href" => "https://example.com/images/asuka_hospital.png"}]
     }
@@ -37,13 +27,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       insert(:user, %{
         follower_count: 3,
         note_count: 5,
-        source_data: source_data,
         background: background_image,
         nickname: "shp@shitposter.club",
         name: ":karjalanpiirakka: shp",
         bio:
           "<script src=\"invalid-html\"></script><span>valid html</span>. a<br>b<br/>c<br >d<br />f",
-        inserted_at: ~N[2017-08-15 15:47:06.597036]
+        inserted_at: ~N[2017-08-15 15:47:06.597036],
+        emoji: %{"karjalanpiirakka" => "/file.png"}
       })
 
     expected = %{
@@ -117,7 +107,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       insert(:user, %{
         follower_count: 3,
         note_count: 5,
-        source_data: %{},
         actor_type: "Service",
         nickname: "shp@shitposter.club",
         inserted_at: ~N[2017-08-15 15:47:06.597036]
@@ -178,9 +167,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
 
     assert represented = AccountView.render("show.json", %{user: user})
     assert represented.acct == "compositions@channels.tests.funkwhale.audio"
-    # assert represented.url == "https://channels.tests.funkwhale.audio/channels/compositions"
-    assert represented.url ==
-             "https://channels.tests.funkwhale.audio/federation/actors/compositions"
+    assert represented.url == "https://channels.tests.funkwhale.audio/channels/compositions"
   end
 
   test "Represent a deactivated user for an admin" do
@@ -211,6 +198,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       relationships_opt = UserRelationship.view_relationships_option(user, [other_user])
       opts = Map.put(opts, :relationships, relationships_opt)
       assert expected_result == AccountView.render("relationship.json", opts)
+
+      assert [expected_result] ==
+               AccountView.render("relationships.json", %{user: user, targets: [other_user]})
     end
 
     @blank_response %{
@@ -310,7 +300,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       insert(:user, %{
         follower_count: 0,
         note_count: 5,
-        source_data: %{},
         actor_type: "Service",
         nickname: "shp@shitposter.club",
         inserted_at: ~N[2017-08-15 15:47:06.597036]