Use json_response_and_validate_schema/2 in tests to validate OpenAPI schema

This commit is contained in:
Egor Kislitsyn 2020-04-27 20:46:52 +04:00
commit 2efc00b3cf
No known key found for this signature in database
GPG key ID: 1B49CB15B71E7805
7 changed files with 330 additions and 358 deletions

View file

@ -82,8 +82,9 @@ defmodule Pleroma.Web.ControllerHelper do
end
end
def assign_account_by_id(%{params: %{"id" => id}} = conn, _) do
case Pleroma.User.get_cached_by_id(id) do
def assign_account_by_id(conn, _) do
# TODO: use `conn.params[:id]` only after moving to OpenAPI
case Pleroma.User.get_cached_by_id(conn.params[:id] || conn.params["id"]) do
%Pleroma.User{} = account -> assign(conn, :account, account)
nil -> Pleroma.Web.MastodonAPI.FallbackController.call(conn, {:error, :not_found}) |> halt()
end