summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/account_view_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/mastodon_api/account_view_test.exs')
-rw-r--r--test/web/mastodon_api/account_view_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs
index 0106fbcc0..259258281 100644
--- a/test/web/mastodon_api/account_view_test.exs
+++ b/test/web/mastodon_api/account_view_test.exs
@@ -2,6 +2,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
use Pleroma.DataCase
import Pleroma.Factory
alias Pleroma.Web.MastodonAPI.AccountView
+ alias Pleroma.User
test "Represent a user account" do
user = insert(:user, %{info: %{"note_count" => 5, "follower_count" => 3}, nickname: "shp@shitposter.club"})
@@ -39,4 +40,23 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert expected == AccountView.render("mention.json", %{user: user})
end
+
+ test "represent a relationship" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, user} = User.follow(user, other_user)
+
+ expected = %{
+ id: other_user.id,
+ following: false,
+ followed_by: true,
+ blocking: false,
+ muting: false,
+ requested: false,
+ domain_blocking: false
+ }
+
+ assert expected == AccountView.render("relationship.json", %{user: user, target: other_user})
+ end
end