X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fadmin_api%2Fsearch_test.exs;h=b974cedd5a2dd7ce11566bef41b76a0534c2036e;hb=9733c9d06563a92e4c58ac906c5f98b617b9e731;hp=501a8d007d1e1b7895121710e297bb00578462ac;hpb=f1f7a11222f4689f000825147d16b366d915f393;p=akkoma
diff --git a/test/web/admin_api/search_test.exs b/test/web/admin_api/search_test.exs
index 501a8d007..b974cedd5 100644
--- a/test/web/admin_api/search_test.exs
+++ b/test/web/admin_api/search_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.SearchTest do
@@ -47,9 +47,9 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
end
test "it returns active/deactivated users" do
- insert(:user, info: %{deactivated: true})
- insert(:user, info: %{deactivated: true})
- insert(:user, info: %{deactivated: false})
+ insert(:user, deactivated: true)
+ insert(:user, deactivated: true)
+ insert(:user, deactivated: false)
{:ok, _results, active_count} =
Search.user(%{
@@ -70,7 +70,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
test "it returns specific user" do
insert(:user)
insert(:user)
- user = insert(:user, nickname: "bob", local: true, info: %{deactivated: false})
+ user = insert(:user, nickname: "bob", local: true, deactivated: false)
{:ok, _results, total_count} = Search.user(%{query: ""})
@@ -108,7 +108,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
end
test "it returns admin user" do
- admin = insert(:user, info: %{is_admin: true})
+ admin = insert(:user, is_admin: true)
insert(:user)
insert(:user)
@@ -119,7 +119,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
end
test "it returns moderator user" do
- moderator = insert(:user, info: %{is_moderator: true})
+ moderator = insert(:user, is_moderator: true)
insert(:user)
insert(:user)
@@ -166,5 +166,16 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do
assert total == 3
assert count == 1
end
+
+ test "it returns unapproved user" do
+ unapproved = insert(:user, approval_pending: true)
+ insert(:user)
+ insert(:user)
+
+ {:ok, _results, total} = Search.user()
+ {:ok, [^unapproved], count} = Search.user(%{need_approval: true})
+ assert total == 3
+ assert count == 1
+ end
end
end