fix: address linting and formatting issues for v1 API

This commit is contained in:
Manus
2026-03-18 17:51:10 -04:00
parent 55dda093c8
commit 964f28a86f
2 changed files with 24 additions and 28 deletions

View File

@@ -1,16 +1,15 @@
import sys
import os
from pathlib import Path
# Absolute path to src
src_path = "/home/ubuntu/timmy-time/Timmy-time-dashboard/src"
if src_path not in sys.path:
sys.path.insert(0, src_path)
from fastapi.testclient import TestClient
from fastapi.testclient import TestClient # noqa: E402
try:
from dashboard.app import app
from dashboard.app import app # noqa: E402
print("✓ Successfully imported dashboard.app")
except ImportError as e:
print(f"✗ Failed to import dashboard.app: {e}")
@@ -18,6 +17,7 @@ except ImportError as e:
client = TestClient(app)
def test_v1_status():
response = client.get("/api/v1/status")
assert response.status_code == 200
@@ -26,17 +26,20 @@ def test_v1_status():
assert "model" in data
assert "uptime" in data
def test_v1_chat_history():
response = client.get("/api/v1/chat/history")
assert response.status_code == 200
data = response.json()
assert "messages" in data
def test_v1_upload_fail():
# Test without file
response = client.post("/api/v1/upload")
assert response.status_code == 422 # Unprocessable Entity (missing file)
if __name__ == "__main__":
print("Running API v1 tests...")
try: