X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fweb%2Fadmin_api%2Fsearch_test.exs;h=b974cedd5a2dd7ce11566bef41b76a0534c2036e;hb=dfc56de167a7c050aadbdb644a97971e3362b614;hp=9df4cd539d0aae12b7c6b26202a8422651f114d0;hpb=a0f101ee806af06bcd4271cd8d57d11ff85ea11a;p=akkoma
diff --git a/test/web/admin_api/search_test.exs b/test/web/admin_api/search_test.exs
index 9df4cd539..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-2019 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