X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fpleroma%2Fweb%2Fadmin_api%2Fsearch_test.exs;h=307578ae00a1a189447a3c9dd73f5ef50535c7ac;hb=87c468f009e048634b705452abbdf2ef489cd055;hp=d88867c5272e0242b0978d809999dcc6c2df191d;hpb=8b6221d4ecd1d7e354e7de831dd46e285cb85077;p=akkoma
diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs
index d88867c52..307578ae0 100644
--- a/test/pleroma/web/admin_api/search_test.exs
+++ b/test/pleroma/web/admin_api/search_test.exs
@@ -1,9 +1,9 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.SearchTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.AdminAPI.Search
@@ -143,6 +143,20 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
assert user2 in users
end
+ test "it returns users by actor_types" do
+ user_service = insert(:user, actor_type: "Service")
+ user_application = insert(:user, actor_type: "Application")
+ user1 = insert(:user)
+ user2 = insert(:user)
+
+ {:ok, [^user_service], 1} = Search.user(%{actor_types: ["Service"]})
+ {:ok, [^user_application], 1} = Search.user(%{actor_types: ["Application"]})
+ {:ok, [^user1, ^user2], 2} = Search.user(%{actor_types: ["Person"]})
+
+ {:ok, [^user_service, ^user1, ^user2], 3} =
+ Search.user(%{actor_types: ["Person", "Service"]})
+ end
+
test "it returns user by display name" do
user = insert(:user, name: "Display name")
insert(:user)
@@ -178,9 +192,21 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
assert count == 1
end
+ test "it returns unconfirmed user" do
+ unconfirmed = insert(:user, confirmation_pending: true)
+ insert(:user)
+ insert(:user)
+
+ {:ok, _results, total} = Search.user()
+ {:ok, [^unconfirmed], count} = Search.user(%{unconfirmed: true})
+ assert total == 3
+ assert count == 1
+ end
+
+ # Note: as in Mastodon, `is_discoverable` doesn't anyhow relate to user searchability
test "it returns non-discoverable users" do
insert(:user)
- insert(:user, discoverable: false)
+ insert(:user, is_discoverable: false)
{:ok, _results, total} = Search.user()