You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
be-lcca/tests/e2e/test_plant_transaction.py

19 lines
721 B
Python

import pytest
from httpx import AsyncClient
@pytest.mark.asyncio
async def test_get_plant_transactions(client: AsyncClient):
response = await client.get("/plant-transaction-data")
assert response.status_code == 200
assert response.json()["message"] == "Data retrieved successfully"
@pytest.mark.asyncio
async def test_get_plant_charts(client: AsyncClient):
# This might return 404 if no data exists, but with my setup_db it should be empty
response = await client.get("/plant-transaction-data/charts")
# Actually, the service might raise 404 if it's empty
if response.status_code == 200:
assert "items" in response.json()["data"]
else:
assert response.status_code == 404