Fix tests
This commit is contained in:
parent
46eb160135
commit
b88dbc17c8
1 changed files with 44 additions and 22 deletions
|
@ -225,7 +225,8 @@ test "Show", %{conn: conn} do
|
|||
"roles" => %{"admin" => false, "moderator" => false},
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
|
||||
assert expected == json_response(conn, 200)
|
||||
|
@ -634,7 +635,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname)
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
},
|
||||
%{
|
||||
"deactivated" => user.deactivated,
|
||||
|
@ -644,7 +646,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
|
|||
"local" => false,
|
||||
"tags" => ["foo", "bar"],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
|> Enum.sort_by(& &1["nickname"])
|
||||
|
@ -685,7 +688,8 @@ test "regular search", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -709,7 +713,8 @@ test "search by domain", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -733,7 +738,8 @@ test "search by full nickname", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -757,7 +763,8 @@ test "search by display name", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -781,7 +788,8 @@ test "search by email", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -805,7 +813,8 @@ test "regular search with page size", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -824,7 +833,8 @@ test "regular search with page size", %{conn: conn} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user2) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user2.name || user2.nickname)
|
||||
"display_name" => HTML.strip_tags(user2.name || user2.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -853,7 +863,8 @@ test "only local users" do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -880,7 +891,8 @@ test "only local users with no query", %{admin: old_admin} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
},
|
||||
%{
|
||||
"deactivated" => admin.deactivated,
|
||||
|
@ -890,7 +902,8 @@ test "only local users with no query", %{admin: old_admin} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname)
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
},
|
||||
%{
|
||||
"deactivated" => false,
|
||||
|
@ -900,7 +913,8 @@ test "only local users with no query", %{admin: old_admin} do
|
|||
"roles" => %{"admin" => true, "moderator" => false},
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(old_admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(old_admin.name || old_admin.nickname)
|
||||
"display_name" => HTML.strip_tags(old_admin.name || old_admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
|> Enum.sort_by(& &1["nickname"])
|
||||
|
@ -929,7 +943,8 @@ test "load only admins", %{conn: conn, admin: admin} do
|
|||
"local" => admin.local,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname)
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
},
|
||||
%{
|
||||
"deactivated" => false,
|
||||
|
@ -939,7 +954,8 @@ test "load only admins", %{conn: conn, admin: admin} do
|
|||
"local" => second_admin.local,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(second_admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(second_admin.name || second_admin.nickname)
|
||||
"display_name" => HTML.strip_tags(second_admin.name || second_admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
|> Enum.sort_by(& &1["nickname"])
|
||||
|
@ -970,7 +986,8 @@ test "load only moderators", %{conn: conn} do
|
|||
"local" => moderator.local,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(moderator) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(moderator.name || moderator.nickname)
|
||||
"display_name" => HTML.strip_tags(moderator.name || moderator.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -994,7 +1011,8 @@ test "load users with tags list", %{conn: conn} do
|
|||
"local" => user1.local,
|
||||
"tags" => ["first"],
|
||||
"avatar" => User.avatar_url(user1) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user1.name || user1.nickname)
|
||||
"display_name" => HTML.strip_tags(user1.name || user1.nickname),
|
||||
"confirmation_pending" => false
|
||||
},
|
||||
%{
|
||||
"deactivated" => false,
|
||||
|
@ -1004,7 +1022,8 @@ test "load users with tags list", %{conn: conn} do
|
|||
"local" => user2.local,
|
||||
"tags" => ["second"],
|
||||
"avatar" => User.avatar_url(user2) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user2.name || user2.nickname)
|
||||
"display_name" => HTML.strip_tags(user2.name || user2.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
|> Enum.sort_by(& &1["nickname"])
|
||||
|
@ -1040,7 +1059,8 @@ test "it works with multiple filters" do
|
|||
"local" => user.local,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1066,7 +1086,8 @@ test "it omits relay user", %{admin: admin} do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname)
|
||||
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1135,7 +1156,8 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation" do
|
|||
"local" => true,
|
||||
"tags" => [],
|
||||
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname)
|
||||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"confirmation_pending" => false
|
||||
}
|
||||
|
||||
log_entry = Repo.one(ModerationLog)
|
||||
|
|
Loading…
Reference in a new issue