Documentation Standardisation & Unit Test Stabilization

- Overhauled README.md to serve as a unified system index and WIP tracker.
- Standardized documentation filenames (ARCH__, GUIDE__, PLAN__) for better discoverability.
- Archived completed project plans and scopes.
- Fixed regressions in unit tests (errors, models, email) caused by V3 architectural updates.
- Ensured unit tests remain non-destructive and environment-independent via mocking.
This commit is contained in:
Scott Idem
2026-01-28 12:15:01 -05:00
parent 3eaf176b05
commit 860cf80a4e
17 changed files with 118 additions and 28 deletions

View File

@@ -1,6 +1,5 @@
import sys
import os
from typing import ClassVar
from unittest.mock import MagicMock
# --- Environment Setup ---
@@ -23,7 +22,7 @@ mock_lib_general = MagicMock()
mock_lib_general.log = MagicMock()
mock_lib_general.logging = MagicMock()
sys.modules['app.lib_general'] = mock_lib_general
sys.modules['app.log'] = MagicMock() # Ensure app.log is also mocked if needed separately
mock_db_sql = MagicMock()
mock_db_sql.redis_lookup_id_random.return_value = 1
mock_db_sql.get_id_random.return_value = "mock_id"
@@ -44,13 +43,7 @@ except Exception as e:
def test_person_null_given_name():
"""Test that given_name=None is converted to empty string."""
try:
# construct() bypasses validation, so we use the constructor
# We provide dummy values for other likely required fields
p = Person_Base.construct(given_name=None)
# Note: In Pydantic V1 validators run on __init__.
# Since we mocked the environment, we'll test the validator function directly if init fails.
from app.models.person_models import Person_Base
# In Pydantic V1, we test the validator classmethod directly if instantiation is too complex with mocks
val = Person_Base.given_name_validator(None)
if val == "":
print("✅ given_name validator: None -> '' (Success)")
@@ -62,7 +55,6 @@ def test_person_null_given_name():
def test_person_null_allow_auth_key():
"""Test that allow_auth_key=None is converted to True."""
try:
from app.models.person_models import Person_Base
val = Person_Base.allow_auth_key_validator(None)
if val is True:
print("✅ allow_auth_key validator: None -> True (Success)")
@@ -73,4 +65,4 @@ def test_person_null_allow_auth_key():
if __name__ == "__main__":
test_person_null_given_name()
test_person_null_allow_auth_key()
test_person_null_allow_auth_key()