XYHLF / tests /test_utt.py
Mbonea's picture
initial commit
9d4bd7c
import pytest
import httpx
pytest_plugins = ["pytest_asyncio"]
# @pytest.mark.asyncio
# async def test_list_funds(client, initialize_tests):
# async with httpx.AsyncClient() as async_client:
# # Import funds first
# await async_client.post("http://localhost:8001/utt/import-all")
# response = await async_client.get("http://localhost:8001/utt/")
# assert response.status_code == 200
# data = response.json()
# assert data["success"] == True
# assert "data" in data
# assert len(data["data"]) > 0
@pytest.mark.asyncio
async def test_get_fund_data(client, initialize_tests):
async with httpx.AsyncClient() as async_client:
# Import funds first
# await async_client.post("http://localhost:8001/utt/import-all")
# Get specific fund data
response = await async_client.get("http://localhost:8001/utt/umoja")
assert response.status_code == 200
data = response.json()
assert data["success"] == True
assert data["data"]["fund"]["symbol"] == "umoja"
assert "data" in data["data"]
@pytest.mark.asyncio
async def test_get_fund_data_not_found(client, initialize_tests):
async with httpx.AsyncClient() as async_client:
response = await async_client.get("http://localhost:8001/utt/INVALID")
assert response.status_code == 404
data = response.json()
assert data["success"] == False
assert "Fund not found" in data["message"]
# @pytest.mark.asyncio
# async def test_queue_import_utt(client, initialize_tests):
# async with httpx.AsyncClient() as async_client:
# response = await async_client.post("http://localhost:8001/utt/import-all")
# assert response.status_code == 200
# data = response.json()
# assert data["success"] == True
# assert "task_id" in data["data"]