28 lines
648 B
Python
28 lines
648 B
Python
from unittest.mock import Mock
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
import spud.daemon
|
|
|
|
|
|
@pytest.fixture(name="client")
|
|
def client_fixture():
|
|
return TestClient(spud.daemon.app)
|
|
|
|
|
|
def test_alive_returns_200(client):
|
|
response = client.get("/")
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
# FIXME: Test premise could be stronger and cover the response schema / API contract.
|
|
def test_check_service_statuses_calls_get_services(client, monkeypatch):
|
|
mock = Mock()
|
|
mock.return_value = []
|
|
monkeypatch.setattr(spud.daemon.PodmanManager, "get_services", mock)
|
|
|
|
client.get("/status")
|
|
|
|
mock.assert_called_once()
|