Initial commit
This commit is contained in:
commit
5cda7bc309
28 changed files with 1173 additions and 0 deletions
23
tests/test_states.py
Normal file
23
tests/test_states.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from yksa_kit.choices import RunStatus
|
||||
from yksa_kit.states import health_state
|
||||
|
||||
|
||||
@pytest.mark.parametrize("status,expected", [
|
||||
("success", "ok"), ("ok", "ok"), ("partial", "warning"), ("failed", "failed"),
|
||||
("error", "failed"), ("running", "running"), ("pending", "running"),
|
||||
("queued", "running"), ("skipped", "skipped"),
|
||||
("", "unknown"), (None, "unknown"), ("something-new", "unknown"),
|
||||
])
|
||||
def test_domain_status_maps_to_one_vocabulary(status, expected):
|
||||
assert health_state(status) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", RunStatus.values)
|
||||
def test_every_run_status_has_a_state(value):
|
||||
"""A new RunStatus member without a mapping would render as `unknown` on every
|
||||
status page, which reads as a bug in the poller rather than a missing table row."""
|
||||
assert health_state(value) != "unknown"
|
||||
Loading…
Add table
Add a link
Reference in a new issue