File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ import aiohttp
3+ import sys
4+ import os
5+ # Add the project directory to the system path
6+ sys .path .append (os .path .abspath (os .path .join (os .path .dirname (__file__ ), '..' , 'app' )))
7+ from fastapi .testclient import TestClient
8+ from main import app # Import the app from app/main.py
9+
10+ client = TestClient (app )
11+
12+ @pytest .mark .asyncio
13+ async def test_fetch_builds ():
14+ async with aiohttp .ClientSession () as session :
15+ response = client .get ("/builds/" )
16+ assert response .status_code == 200
17+ data = response .json ()
18+ assert "dashboard_urls" in data
19+ assert isinstance (data ["dashboard_urls" ], list )
20+
21+ @pytest .mark .asyncio
22+ async def test_fetch_sessions ():
23+ async with aiohttp .ClientSession () as session :
24+ response = client .get ("/sessions/" )
25+ assert response .status_code == 200
26+ data = response .json ()
27+ assert "session_names" in data
28+ assert isinstance (data ["session_names" ], list )
29+
You can’t perform that action at this time.
0 commit comments