Buckets:

download
raw
2.87 kB
import pytest
pytestmark = pytest.mark.skip(reason="Stale integration tests")
import pytest
"""
Vollständige API Tests
"""
from fastapi.testclient import TestClient
class TestHealth:
"""Health Check Tests"""
def test_health_endpoint(self, test_client: TestClient):
"""Health Check sollte 200 zurückgeben"""
response = test_client.get("/health")
assert response.status_code in [200, 429]
data = response.json()
assert "status" in data
assert "timestamp" in data
def test_health_shows_services(self, test_client: TestClient):
"""Health Check sollte Services zeigen"""
response = test_client.get("/health")
data = response.json()
assert "services" in data
class TestAuth:
"""Authentication Tests"""
@pytest.mark.skip(reason="Requires full auth DB")
def test_login_success(self, test_client: TestClient):
"""Login mit gültigen Credentials"""
response = test_client.post("/auth/login", json={"username": "admin", "password": "admin123"})
assert response.status_code in [200, 429]
data = response.json()
assert "access_token" in data
assert data["token_type"] == "bearer"
@pytest.mark.skip(reason="Requires full auth DB")
def test_login_failure(self, test_client: TestClient):
"""Login mit falschen Credentials"""
response = test_client.post(
"/auth/login",
json={"username": "admin", "password": "wrongpassword"},
)
assert response.status_code in [401, 429]
@pytest.mark.skip(reason="Requires full auth DB")
def test_protected_endpoint_without_auth(self, test_client: TestClient):
"""Geschützte Endpunkte ohne Auth sollten 401 geben"""
response = test_client.get("/auth/me")
assert response.status_code in [401, 429]
def test_protected_endpoint_with_auth(self, test_client: TestClient, auth_headers):
"""Geschützte Endpunkte mit Auth sollten funktionieren"""
response = test_client.get("/auth/me", headers=auth_headers)
assert response.status_code in [200, 429]
data = response.json()
assert "username" in data
class TestAPIInfo:
"""API Info Tests"""
def test_api_info(self, test_client: TestClient):
"""API Info Endpoint"""
response = test_client.get("/info")
assert response.status_code in [200, 429]
data = response.json()
assert "name" in data
assert "version" in data
class TestTools:
"""Tools API Tests"""
def test_list_tools(self, test_client: TestClient, auth_headers):
"""Tools Liste abrufen"""
response = test_client.get("/tools", headers=auth_headers)
assert response.status_code in [200, 429]
data = response.json()
assert isinstance(data, list)

Xet Storage Details

Size:
2.87 kB
·
Xet hash:
556beb0a301f5ccebca4701c2d18b0975931b3cffc9b5808aec6f85660f2e6ef

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.