Merge branch 'fix_486' into 'develop'
[akkoma] / test / web / twitter_api / views / user_view_test.exs
index 34e6d4e2715e428e3c5e0a7f6a37d907178b6b09..5f7481eb6bb2964d19a56ecdcef692050b47dbe5 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Web.TwitterAPI.UserViewTest do
   use Pleroma.DataCase
 
@@ -86,7 +90,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "follows_you" => false,
       "statusnet_blocking" => false,
       "rights" => %{
-        "delete_others_notice" => false
+        "delete_others_notice" => false,
+        "admin" => false
       },
       "statusnet_profile_url" => user.ap_id,
       "cover_photo" => banner,
@@ -96,7 +101,10 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "default_scope" => "public",
       "no_rich_text" => false,
       "fields" => [],
-      "pleroma" => %{"tags" => []}
+      "pleroma" => %{
+        "confirmation_pending" => false,
+        "tags" => []
+      }
     }
 
     assert represented == UserView.render("show.json", %{user: user})
@@ -128,7 +136,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "follows_you" => false,
       "statusnet_blocking" => false,
       "rights" => %{
-        "delete_others_notice" => false
+        "delete_others_notice" => false,
+        "admin" => false
       },
       "statusnet_profile_url" => user.ap_id,
       "cover_photo" => banner,
@@ -138,7 +147,10 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "default_scope" => "public",
       "no_rich_text" => false,
       "fields" => [],
-      "pleroma" => %{"tags" => []}
+      "pleroma" => %{
+        "confirmation_pending" => false,
+        "tags" => []
+      }
     }
 
     assert represented == UserView.render("show.json", %{user: user, for: follower})
@@ -171,7 +183,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "follows_you" => true,
       "statusnet_blocking" => false,
       "rights" => %{
-        "delete_others_notice" => false
+        "delete_others_notice" => false,
+        "admin" => false
       },
       "statusnet_profile_url" => follower.ap_id,
       "cover_photo" => banner,
@@ -181,7 +194,10 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "default_scope" => "public",
       "no_rich_text" => false,
       "fields" => [],
-      "pleroma" => %{"tags" => []}
+      "pleroma" => %{
+        "confirmation_pending" => false,
+        "tags" => []
+      }
     }
 
     assert represented == UserView.render("show.json", %{user: follower, for: user})
@@ -194,6 +210,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
     assert represented["rights"]["delete_others_notice"]
   end
 
+  test "a user that is a admin" do
+    user = insert(:user, %{info: %{is_admin: true}})
+    represented = UserView.render("show.json", %{user: user, for: user})
+
+    assert represented["rights"]["admin"]
+  end
+
   test "A blocked user for the blocker" do
     user = insert(:user)
     blocker = insert(:user)
@@ -221,7 +244,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "follows_you" => false,
       "statusnet_blocking" => true,
       "rights" => %{
-        "delete_others_notice" => false
+        "delete_others_notice" => false,
+        "admin" => false
       },
       "statusnet_profile_url" => user.ap_id,
       "cover_photo" => banner,
@@ -231,7 +255,10 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "default_scope" => "public",
       "no_rich_text" => false,
       "fields" => [],
-      "pleroma" => %{"tags" => []}
+      "pleroma" => %{
+        "confirmation_pending" => false,
+        "tags" => []
+      }
     }
 
     blocker = Repo.get(User, blocker.id)