Merge branch 'issue/936' into 'develop'

[#936] fix tests

See merge request pleroma/pleroma!1208
This commit is contained in:
lambda 2019-05-29 14:04:58 +00:00
commit 6fb67b74da
1 changed files with 96 additions and 80 deletions

View File

@ -437,10 +437,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} 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 @@ test "renders users array for the first page", %{conn: conn, admin: admin} 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 @@ test "only local users with no query", %{admin: old_admin} 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 @@ test "only local users with no query", %{admin: old_admin} 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 @@ test "load only admins", %{conn: conn, admin: admin} 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 @@ test "load only admins", %{conn: conn, admin: admin} 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 @@ test "load users with tags list", %{conn: conn} 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 @@ test "load users with tags list", %{conn: conn} do
"tags" => ["second"] "tags" => ["second"]
} }
] ]
|> Enum.sort_by(& &1["nickname"])
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => users
} }
end end