responses: %{
200 => Operation.response("Account", "application/json", Account),
401 => Operation.response("Error", "application/json", ApiError),
- 404 => Operation.response("Error", "application/json", ApiError),
- 410 => Operation.response("Error", "application/json", ApiError)
+ 404 => Operation.response("Error", "application/json", ApiError)
}
}
end
responses: %{
200 => Operation.response("Statuses", "application/json", array_of_statuses()),
401 => Operation.response("Error", "application/json", ApiError),
- 404 => Operation.response("Error", "application/json", ApiError),
- 410 => Operation.response("Error", "application/json", ApiError)
+ 404 => Operation.response("Error", "application/json", ApiError)
}
}
end
defp user_visibility_error(conn, error) do
case error do
- :deactivated ->
- render_error(conn, :gone, "")
-
:restrict_unauthenticated ->
render_error(conn, :unauthorized, "This API requires an authenticated user")
test "returns 401 for deactivated user", %{conn: conn} do
user = insert(:user, deactivated: true)
- assert %{} =
+ assert %{"error" => "Can't find user"} =
conn
|> get("/api/v1/accounts/#{user.id}")
- |> json_response_and_validate_schema(:gone)
+ |> json_response_and_validate_schema(:not_found)
end
end
test "deactivated user", %{conn: conn} do
user = insert(:user, deactivated: true)
- assert %{} ==
+ assert %{"error" => "Can't find user"} ==
conn
|> get("/api/v1/accounts/#{user.id}/statuses")
- |> json_response_and_validate_schema(:gone)
+ |> json_response_and_validate_schema(:not_found)
end
test "returns 404 when user is invisible", %{conn: conn} do