Add test for the second page
This commit is contained in:
parent
72b7a0797e
commit
70e82a3465
@ -331,7 +331,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||||||
assert conn.status == 200
|
assert conn.status == 200
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/admin/users" do
|
describe "GET /api/pleroma/admin/users" do
|
||||||
|
test "renders users array for the first page" do
|
||||||
admin = insert(:user, info: %{is_admin: true})
|
admin = insert(:user, info: %{is_admin: true})
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
@ -353,6 +354,23 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "renders empty array for the second page" do
|
||||||
|
admin = insert(:user, info: %{is_admin: true})
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
conn =
|
||||||
|
build_conn()
|
||||||
|
|> assign(:user, admin)
|
||||||
|
|> get("/api/pleroma/admin/users?page=2")
|
||||||
|
|
||||||
|
assert json_response(conn, 200) == %{
|
||||||
|
"count" => 1,
|
||||||
|
"page_size" => 50,
|
||||||
|
"users" => []
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation" do
|
test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation" do
|
||||||
admin = insert(:user, info: %{is_admin: true})
|
admin = insert(:user, info: %{is_admin: true})
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
Loading…
Reference in New Issue
Block a user