X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Ftwitter_api%2Fviews%2Fuser_view_test.exs;h=95e52ca46a988d7fea21a72f53af9dd44ae5deff;hb=921571c19bf4a7fcea666aa70744a02fe108d11a;hp=b8f1afa76fce4603398c38ead46342ff9c2f84d9;hpb=2bfae25a1ff735499e15cb431314503f34097a6b;p=akkoma
diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs
index b8f1afa76..95e52ca46 100644
--- a/test/web/twitter_api/views/user_view_test.exs
+++ b/test/web/twitter_api/views/user_view_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
import Pleroma.Factory
setup do
- user = insert(:user, bio: "Here's some html, @mention@domain.com")
+ user = insert(:user, bio: "Here's some html")
[user: user]
end
@@ -100,6 +100,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
+ "hide_follows" => false,
+ "hide_followers" => false,
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
@@ -146,6 +148,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
+ "hide_follows" => false,
+ "hide_followers" => false,
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
@@ -193,6 +197,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
+ "hide_follows" => false,
+ "hide_followers" => false,
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
@@ -208,6 +214,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
represented = UserView.render("show.json", %{user: user, for: user})
assert represented["rights"]["delete_others_notice"]
+ assert represented["role"] == "moderator"
end
test "a user that is a admin" do
@@ -215,6 +222,21 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
represented = UserView.render("show.json", %{user: user, for: user})
assert represented["rights"]["admin"]
+ assert represented["role"] == "admin"
+ end
+
+ test "A moderator with hidden role for another user", %{user: user} do
+ admin = insert(:user, %{info: %{is_moderator: true, show_role: false}})
+ represented = UserView.render("show.json", %{user: admin, for: user})
+
+ assert represented["role"] == nil
+ end
+
+ test "An admin with hidden role for another user", %{user: user} do
+ admin = insert(:user, %{info: %{is_admin: true, show_role: false}})
+ represented = UserView.render("show.json", %{user: admin, for: user})
+
+ assert represented["role"] == nil
end
test "A blocked user for the blocker" do
@@ -254,6 +276,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"locked" => false,
"default_scope" => "public",
"no_rich_text" => false,
+ "hide_follows" => false,
+ "hide_followers" => false,
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,