X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmastodon_api%2Fviews%2Faccount_view_test.exs;h=ed6f2ecbd7577f70de4c67c074c3d636c43531f1;hb=30caf3e51e32830153e693727b3765e8817171a3;hp=4e5da6b068c18f9e6d3a2c643ee52117276d7046;hpb=ba5cc3016514080b4bf7eaefd3e25936c0e222ba;p=akkoma diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 4e5da6b06..ed6f2ecbd 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -102,7 +102,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do privacy = user.default_scope assert %{ - pleroma: %{notification_settings: ^notification_settings}, + pleroma: %{notification_settings: ^notification_settings, allow_following_move: true}, source: %{privacy: ^privacy} } = AccountView.render("show.json", %{user: user, for: user}) end @@ -190,7 +190,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do {:ok, user} = User.follow(user, other_user) {:ok, other_user} = User.follow(other_user, user) - {:ok, other_user} = User.subscribe(user, other_user) + {:ok, _subscription} = User.subscribe(user, other_user) {:ok, _user_relationships} = User.mute(user, other_user, true) {:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, other_user) @@ -218,7 +218,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do other_user = insert(:user) {:ok, user} = User.follow(user, other_user) - {:ok, other_user} = User.subscribe(user, other_user) + {:ok, _subscription} = User.subscribe(user, other_user) {:ok, _user_relationship} = User.block(user, other_user) {:ok, _user_relationship} = User.block(other_user, user) @@ -350,7 +350,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do } } - assert expected == AccountView.render("show.json", %{user: user, for: other_user}) + assert expected == + AccountView.render("show.json", %{user: refresh_record(user), for: other_user}) end test "returns the settings store if the requesting user is the represented user and it's requested specifically" do @@ -374,6 +375,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do refute result.display_name == " username " end + test "never display nil user follow counts" do + user = insert(:user, following_count: 0, follower_count: 0) + result = AccountView.render("show.json", %{user: user}) + + assert result.following_count == 0 + assert result.followers_count == 0 + end + describe "hiding follows/following" do test "shows when follows/followers stats are hidden and sets follow/follower count to 0" do user =