Files
zangramru/tests/test_puzzles.py
T
s3rius 4306676699
Testing zangramru / lint (push) Successful in 31s
Testing zangramru / pytest (push) Failing after 16s
Simplified workflows.
Signed-off-by: Pavel Kirilin <s3riussan@gmail.com>
2026-07-01 13:42:32 +02:00

21 lines
659 B
Python

from fastapi import FastAPI
from httpx import AsyncClient
from starlette import status
from zangramru.web.api.puzzles.schema import PuzzleOutputDTO
async def test_get_random_puzzle(fastapi_app: FastAPI, client: AsyncClient) -> None:
"""
Tests that echo route works.
:param fastapi_app: current application.
:param client: client for the app.
"""
url = fastapi_app.url_path_for("random_puzzle")
response = await client.get(url)
assert response.status_code == status.HTTP_200_OK
dto = PuzzleOutputDTO.model_validate(response.json())
assert sum(len(row) for row in dto.board) == 16
assert len(dto.solutions) >= 10