39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from app.main import app
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_root():
|
|
"""Test root endpoint"""
|
|
response = client.get("/")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert "message" in data
|
|
assert "version" in data
|
|
|
|
|
|
def test_health():
|
|
"""Test health check endpoint"""
|
|
response = client.get("/health")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "healthy"
|
|
|
|
|
|
# Add more tests as needed
|
|
# def test_upload_artifact():
|
|
# """Test artifact upload"""
|
|
# files = {"file": ("test.csv", b"test,data\n1,2", "text/csv")}
|
|
# data = {
|
|
# "test_name": "sample_test",
|
|
# "test_suite": "unit",
|
|
# "test_result": "pass"
|
|
# }
|
|
# response = client.post("/api/v1/artifacts/upload", files=files, data=data)
|
|
# assert response.status_code == 201
|
|
# artifact = response.json()
|
|
# assert artifact["filename"] == "test.csv"
|
|
# assert artifact["test_name"] == "sample_test"
|