35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Tests für Flask-App-Factory."""
|
|
|
|
import pytest as pt
|
|
from flask import Flask
|
|
|
|
from src.app import create_app
|
|
|
|
|
|
class TestCreateApp:
|
|
"""Tests für create_app."""
|
|
|
|
def test_create_app_gibt_flask_app_zurueck(self) -> None:
|
|
"""create_app() gibt Flask-App zurück."""
|
|
app = create_app()
|
|
assert isinstance(app, Flask)
|
|
|
|
def test_health_endpoint_ergibt_ok(self) -> None:
|
|
"""GET /health → 200, JSON mit 'status': 'ok'."""
|
|
app = create_app()
|
|
|
|
with app.test_client() as client:
|
|
response = client.get("/health")
|
|
assert response.status_code == 200
|
|
data = response.get_json()
|
|
assert data["status"] == "ok"
|
|
|
|
def test_health_endpoint_queue_size_ist_integer(self) -> None:
|
|
"""GET /health → queue_size ist Integer."""
|
|
app = create_app()
|
|
|
|
with app.test_client() as client:
|
|
response = client.get("/health")
|
|
data = response.get_json()
|
|
assert isinstance(data["queue_size"], int)
|