Files
birdcam/tests/test_heartbeat.py
2026-03-16 16:56:18 -07:00

27 lines
636 B
Python

from collections.abc import Generator
from typing import Any
import pytest
from flask.testing import FlaskClient
from src.app import app
@pytest.fixture
def client() -> Generator[FlaskClient, Any, Any]:
app.config["TESTING"] = True
with app.test_client() as client:
yield client
def test_heartbeat_status_code(client: FlaskClient) -> None:
response = client.get("/heartbeat")
assert response.status_code == 200
def test_heartbeat_payload(client: FlaskClient) -> None:
response = client.get("/heartbeat")
data = response.get_json()
assert data["status"] == "ok"
assert "timestamp" in data