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

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