From 8dc37f274f46d6f674898e9535ffd2e5b7cb0fcc Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 9 Jan 2026 15:40:46 -0500 Subject: [PATCH] Just saving changes --- tests/test_v3_crud_fixes.py | 121 ------------------------------------ 1 file changed, 121 deletions(-) delete mode 100644 tests/test_v3_crud_fixes.py diff --git a/tests/test_v3_crud_fixes.py b/tests/test_v3_crud_fixes.py deleted file mode 100644 index fbe658c..0000000 --- a/tests/test_v3_crud_fixes.py +++ /dev/null @@ -1,121 +0,0 @@ -import sys -import os -from unittest.mock import MagicMock - -# Mock dependencies -sys.modules['redis'] = MagicMock() -sys.modules['sqlalchemy'] = MagicMock() -sys.modules['sqlalchemy.exc'] = MagicMock() -sys.modules['sqlalchemy.pool'] = MagicMock() -sys.modules['fastapi'] = MagicMock() -sys.modules['app.config'] = MagicMock() -sys.modules['html2text'] = MagicMock() -sys.modules['app.lib_email'] = MagicMock() -sys.modules['app.lib_export'] = MagicMock() -sys.modules['app.lib_jwt'] = MagicMock() -sys.modules['app.lib_hash'] = MagicMock() - -# Mock app.log -mock_log = MagicMock() -sys.modules['app.log'] = mock_log - -# Mock app.lib_general -mock_lib_general = MagicMock() -mock_lib_general.log = MagicMock() -mock_lib_general.logging = MagicMock() -sys.modules['app.lib_general'] = mock_lib_general - -# Mock app.db_sql because it does heavy setup -mock_db_sql = MagicMock() -mock_db_sql.redis_lookup_id_random.return_value = None -mock_db_sql.get_id_random.return_value = "mock_random_id" -sys.modules['app.db_sql'] = mock_db_sql - -# Add project root to path -sys.path.append(os.getcwd()) - -try: - from app.models.person_models import Person_Base - from app.models.journal_models import Journal_Base - from app.models.journal_entry_models import Journal_Entry_Base - from app.models.address_models import Address_Base - from app.models.contact_models import Contact_Base - print("✅ Models imported successfully (with mocks).") -except ImportError as e: - print(f"❌ Import Error: {e}") - sys.exit(1) -except Exception as e: - print(f"❌ Setup Error: {e}") - sys.exit(1) - -def test_person_validators(): - print("\n--- Testing Person_Base Validators ---") - - # Test 1: given_name = None -> "" - try: - p = Person_Base(given_name=None, person_id=123, account_id=456) - if p.given_name == "": - print("✅ given_name=None converted to empty string.") - else: - print(f"❌ given_name=None NOT converted. Got: {p.given_name!r}") - except Exception as e: - print(f"❌ Person_Base instantiation failed: {e}") - - # Test 2: allow_auth_key = None -> True - try: - p = Person_Base(allow_auth_key=None, person_id=123, account_id=456) - if p.allow_auth_key is True: - print("✅ allow_auth_key=None converted to True.") - else: - print(f"❌ allow_auth_key=None NOT converted. Got: {p.allow_auth_key!r}") - except Exception as e: - print(f"❌ Person_Base instantiation failed: {e}") - -def test_journal_exclusions(): - print("\n--- Testing Journal_Base Exclusions ---") - - if hasattr(Journal_Base, 'fields_to_exclude_from_db'): - excluded = Journal_Base.fields_to_exclude_from_db - print(f"✅ Journal_Base has fields_to_exclude_from_db: {excluded}") - if 'person_full_name' in excluded: - print("✅ 'person_full_name' is in excluded list.") - else: - print("❌ 'person_full_name' MISSING from excluded list.") - else: - print("❌ Journal_Base missing fields_to_exclude_from_db attribute.") - -def test_journal_entry_exclusions(): - print("\n--- Testing Journal_Entry_Base Exclusions ---") - - if hasattr(Journal_Entry_Base, 'fields_to_exclude_from_db'): - excluded = Journal_Entry_Base.fields_to_exclude_from_db - print(f"✅ Journal_Entry_Base has fields_to_exclude_from_db: {excluded}") - if 'file_count' in excluded: - print("✅ 'file_count' is in excluded list.") - else: - print("❌ 'file_count' MISSING from excluded list.") - else: - print("❌ Journal_Entry_Base missing fields_to_exclude_from_db attribute.") - -def test_address_instantiation(): - print("\n--- Testing Address_Base Instantiation ---") - try: - fields = Address_Base.__fields__ - print(f"✅ Address_Base loaded. Fields: {len(fields)}") - except Exception as e: - print(f"❌ Address_Base check failed: {e}") - -def test_contact_instantiation(): - print("\n--- Testing Contact_Base Instantiation ---") - try: - fields = Contact_Base.__fields__ - print(f"✅ Contact_Base loaded. Fields: {len(fields)}") - except Exception as e: - print(f"❌ Contact_Base check failed: {e}") - -if __name__ == "__main__": - test_person_validators() - test_journal_exclusions() - test_journal_entry_exclusions() - test_address_instantiation() - test_contact_instantiation()