X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fuser_search_test.exs;h=f030523d3a9ac178fa7cda4d0df7980f873d160f;hb=e6a13d97d0f9715980a12a2b73d961aefc52289a;hp=fe52cc7a1e6059b2496208217c5fee065a8ba799;hpb=3eddd9caa61a2ac431eb57cd4c835db608702a7d;p=akkoma
diff --git a/test/user_search_test.exs b/test/user_search_test.exs
index fe52cc7a1..f030523d3 100644
--- a/test/user_search_test.exs
+++ b/test/user_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.UserSearchTest do
@@ -15,9 +15,9 @@ defmodule Pleroma.UserSearchTest do
end
describe "User.search" do
- clear_config([:instance, :limit_to_local_content])
+ setup do: clear_config([:instance, :limit_to_local_content])
- test "excluded invisible users from results" do
+ test "excludes invisible users from results" do
user = insert(:user, %{nickname: "john t1000"})
insert(:user, %{invisible: true, nickname: "john t800"})
@@ -25,6 +25,15 @@ defmodule Pleroma.UserSearchTest do
assert found_user.id == user.id
end
+ test "excludes service actors from results" do
+ insert(:user, actor_type: "Application", nickname: "user1")
+ service = insert(:user, actor_type: "Service", nickname: "user2")
+ person = insert(:user, actor_type: "Person", nickname: "user3")
+
+ assert [found_user1, found_user2] = User.search("user")
+ assert [found_user1.id, found_user2.id] -- [service.id, person.id] == []
+ end
+
test "accepts limit parameter" do
Enum.each(0..4, &insert(:user, %{nickname: "john#{&1}"}))
assert length(User.search("john", limit: 3)) == 3
@@ -172,6 +181,7 @@ defmodule Pleroma.UserSearchTest do
|> Map.put(:search_rank, nil)
|> Map.put(:search_type, nil)
|> Map.put(:last_digest_emailed_at, nil)
+ |> Map.put(:multi_factor_authentication_settings, nil)
|> Map.put(:notification_settings, nil)
assert user == expected