mirror of
https://github.com/FutureOfMedTech-FITM-hack/backend.git
synced 2025-10-18 17:44:22 +03:00
27 lines
641 B
Python
27 lines
641 B
Python
import uuid
|
|
|
|
import pytest
|
|
from fastapi import FastAPI
|
|
from httpx import AsyncClient
|
|
from starlette import status
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_echo(fastapi_app: FastAPI, client: AsyncClient) -> None:
|
|
"""
|
|
Tests that echo route works.
|
|
|
|
:param fastapi_app: current application.
|
|
:param client: clien for the app.
|
|
"""
|
|
url = fastapi_app.url_path_for("send_echo_message")
|
|
message = uuid.uuid4().hex
|
|
response = await client.post(
|
|
url,
|
|
json={
|
|
"message": message,
|
|
},
|
|
)
|
|
assert response.status_code == status.HTTP_200_OK
|
|
assert response.json()["message"] == message
|