[#936] fix tests

This commit is contained in:
Maksim 2019-05-29 14:04:58 +00:00 committed by lambda
parent 57e58d2602
commit db94294dfb

View file

@ -437,10 +437,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
user = insert(:user, local: false, tags: ["foo", "bar"])
conn = get(conn, "/api/pleroma/admin/users?page=1")
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => [
users =
[
%{
"deactivated" => admin.info.deactivated,
"id" => admin.id,
@ -458,6 +456,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"tags" => ["foo", "bar"]
}
]
|> Enum.sort_by(& &1["nickname"])
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => users
}
end
@ -659,10 +663,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|> assign(:user, admin)
|> get("/api/pleroma/admin/users?filters=local")
assert json_response(conn, 200) == %{
"count" => 3,
"page_size" => 50,
"users" => [
users =
[
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
@ -688,6 +690,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"tags" => []
}
]
|> Enum.sort_by(& &1["nickname"])
assert json_response(conn, 200) == %{
"count" => 3,
"page_size" => 50,
"users" => users
}
end
@ -698,10 +706,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
conn = get(conn, "/api/pleroma/admin/users?filters=is_admin")
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => [
users =
[
%{
"deactivated" => false,
"id" => admin.id,
@ -719,6 +725,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"tags" => []
}
]
|> Enum.sort_by(& &1["nickname"])
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => users
}
end
@ -753,10 +765,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
conn = get(conn, "/api/pleroma/admin/users?tags[]=first&tags[]=second")
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => [
users =
[
%{
"deactivated" => false,
"id" => user1.id,
@ -774,6 +784,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"tags" => ["second"]
}
]
|> Enum.sort_by(& &1["nickname"])
assert json_response(conn, 200) == %{
"count" => 2,
"page_size" => 50,
"users" => users
}
end