pagination fix for service users filters
This commit is contained in:
parent
0dd863f8f5
commit
ecf37b46d2
4 changed files with 49 additions and 30 deletions
|
|
@ -18,6 +18,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
alias Pleroma.ReportNote
|
||||
alias Pleroma.Tests.ObanHelpers
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web
|
||||
alias Pleroma.UserInviteToken
|
||||
alias Pleroma.Web.ActivityPub.Relay
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
|
@ -737,6 +738,39 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
}
|
||||
end
|
||||
|
||||
test "pagination works correctly with service users", %{conn: conn} do
|
||||
service1 = insert(:user, ap_id: Web.base_url() <> "/relay")
|
||||
service2 = insert(:user, ap_id: Web.base_url() <> "/internal/fetch")
|
||||
insert_list(25, :user)
|
||||
|
||||
assert %{"count" => 26, "page_size" => 10, "users" => users1} =
|
||||
conn
|
||||
|> get("/api/pleroma/admin/users?page=1&filters=", %{page_size: "10"})
|
||||
|> json_response(200)
|
||||
|
||||
assert Enum.count(users1) == 10
|
||||
assert service1 not in [users1]
|
||||
assert service2 not in [users1]
|
||||
|
||||
assert %{"count" => 26, "page_size" => 10, "users" => users2} =
|
||||
conn
|
||||
|> get("/api/pleroma/admin/users?page=2&filters=", %{page_size: "10"})
|
||||
|> json_response(200)
|
||||
|
||||
assert Enum.count(users2) == 10
|
||||
assert service1 not in [users2]
|
||||
assert service2 not in [users2]
|
||||
|
||||
assert %{"count" => 26, "page_size" => 10, "users" => users3} =
|
||||
conn
|
||||
|> get("/api/pleroma/admin/users?page=3&filters=", %{page_size: "10"})
|
||||
|> json_response(200)
|
||||
|
||||
assert Enum.count(users3) == 6
|
||||
assert service1 not in [users3]
|
||||
assert service2 not in [users3]
|
||||
end
|
||||
|
||||
test "renders empty array for the second page", %{conn: conn} do
|
||||
insert(:user)
|
||||
|
||||
|
|
@ -3526,7 +3560,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
end
|
||||
|
||||
test "success", %{conn: conn} do
|
||||
base_url = Pleroma.Web.base_url()
|
||||
base_url = Web.base_url()
|
||||
app_name = "Trusted app"
|
||||
|
||||
response =
|
||||
|
|
@ -3547,7 +3581,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
end
|
||||
|
||||
test "with trusted", %{conn: conn} do
|
||||
base_url = Pleroma.Web.base_url()
|
||||
base_url = Web.base_url()
|
||||
app_name = "Trusted app"
|
||||
|
||||
response =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue