This repository has been archived on 2024-06-02. You can view files and clone it, but cannot push or open issues or pull requests.
spud-py/tests/test_daemon.py
Marc Cataford 17781b0eb9
All checks were successful
/ Static Analysis (push) Successful in 1m5s
/ Tests (push) Successful in 52s
feat: add status command to query the basic status meta of services
2024-04-14 00:27:55 -04:00

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()