Archived
22 lines
726 B
Python
22 lines
726 B
Python
from karldns.schemas import _account_status, _row_text
|
|||
|
|
|
||
|
|
|
||
|
|
def test_row_text_returns_none_for_missing_or_empty_values():
|
||
|
|
row = {
|
||
|
|
"empty": "",
|
||
|
|
"missing": None,
|
||
|
|
"number": 42,
|
||
|
|
"text": "hello",
|
||
|
|
}
|
||
|
|
|
||
|
|
assert _row_text(row, "empty") is None
|
||
|
|
assert _row_text(row, "missing") is None
|
||
|
|
assert _row_text(row, "unknown") is None
|
||
|
|
assert _row_text(row, "number") == "42"
|
||
|
|
assert _row_text(row, "text") == "hello"
|
||
|
|
|
||
|
|
|
||
|
|
def test_account_status_prefers_disabled_before_lifecycle_state():
|
||
|
|
assert _account_status({"disabled": True, "accepted_at": "2026-01-01"}) == "disabled"
|
||
|
|
assert _account_status({"accepted_at": "2026-01-01"}) == "active"
|
||
|
|
assert _account_status({}) == "pending"
|