[#936] fix tests
This commit is contained in:
parent
57e58d2602
commit
db94294dfb
1 changed files with 96 additions and 80 deletions
|
@ -437,10 +437,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
user = insert(:user, local: false, tags: ["foo", "bar"])
|
user = insert(:user, local: false, tags: ["foo", "bar"])
|
||||||
conn = get(conn, "/api/pleroma/admin/users?page=1")
|
conn = get(conn, "/api/pleroma/admin/users?page=1")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
users =
|
||||||
"count" => 2,
|
[
|
||||||
"page_size" => 50,
|
|
||||||
"users" => [
|
|
||||||
%{
|
%{
|
||||||
"deactivated" => admin.info.deactivated,
|
"deactivated" => admin.info.deactivated,
|
||||||
"id" => admin.id,
|
"id" => admin.id,
|
||||||
|
@ -458,6 +456,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
"tags" => ["foo", "bar"]
|
"tags" => ["foo", "bar"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|> Enum.sort_by(& &1["nickname"])
|
||||||
|
|
||||||
|
assert json_response(conn, 200) == %{
|
||||||
|
"count" => 2,
|
||||||
|
"page_size" => 50,
|
||||||
|
"users" => users
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -659,10 +663,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> get("/api/pleroma/admin/users?filters=local")
|
|> get("/api/pleroma/admin/users?filters=local")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
users =
|
||||||
"count" => 3,
|
[
|
||||||
"page_size" => 50,
|
|
||||||
"users" => [
|
|
||||||
%{
|
%{
|
||||||
"deactivated" => user.info.deactivated,
|
"deactivated" => user.info.deactivated,
|
||||||
"id" => user.id,
|
"id" => user.id,
|
||||||
|
@ -688,6 +690,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|> Enum.sort_by(& &1["nickname"])
|
||||||
|
|
||||||
|
assert json_response(conn, 200) == %{
|
||||||
|
"count" => 3,
|
||||||
|
"page_size" => 50,
|
||||||
|
"users" => users
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -698,10 +706,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?filters=is_admin")
|
conn = get(conn, "/api/pleroma/admin/users?filters=is_admin")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
users =
|
||||||
"count" => 2,
|
[
|
||||||
"page_size" => 50,
|
|
||||||
"users" => [
|
|
||||||
%{
|
%{
|
||||||
"deactivated" => false,
|
"deactivated" => false,
|
||||||
"id" => admin.id,
|
"id" => admin.id,
|
||||||
|
@ -719,6 +725,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
"tags" => []
|
"tags" => []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|> Enum.sort_by(& &1["nickname"])
|
||||||
|
|
||||||
|
assert json_response(conn, 200) == %{
|
||||||
|
"count" => 2,
|
||||||
|
"page_size" => 50,
|
||||||
|
"users" => users
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -753,10 +765,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?tags[]=first&tags[]=second")
|
conn = get(conn, "/api/pleroma/admin/users?tags[]=first&tags[]=second")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
users =
|
||||||
"count" => 2,
|
[
|
||||||
"page_size" => 50,
|
|
||||||
"users" => [
|
|
||||||
%{
|
%{
|
||||||
"deactivated" => false,
|
"deactivated" => false,
|
||||||
"id" => user1.id,
|
"id" => user1.id,
|
||||||
|
@ -774,6 +784,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||||
"tags" => ["second"]
|
"tags" => ["second"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|> Enum.sort_by(& &1["nickname"])
|
||||||
|
|
||||||
|
assert json_response(conn, 200) == %{
|
||||||
|
"count" => 2,
|
||||||
|
"page_size" => 50,
|
||||||
|
"users" => users
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue