- Categorized scripts into tests/unit/, tests/integration/, tests/e2e/, and tests/tools/. - Adopted consistent naming prefixes (test_unit_*, test_int_*, test_e2e_*, tool_*). - Renamed conftest_mock.py to mock_config_helper.py for clarity. - Updated test_int_boot_diagnosis.py with sys.path setup for root-level execution.
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
import sys
|
|
import os
|
|
import json
|
|
import sqlalchemy
|
|
from sqlalchemy import text
|
|
|
|
# Add current directory to path
|
|
sys.path.append(os.getcwd())
|
|
|
|
# MUST BE FIRST: Mock app.config
|
|
import tests.mock_config_helper
|
|
|
|
# Connection details from .env (Bypassing app.config)
|
|
DB_USER = "aether_dev"
|
|
DB_PASS = "$1sky.AE_dev.2023"
|
|
DB_SERVER = "vpn-db.oneskyit.com"
|
|
DB_PORT = "3306"
|
|
DB_NAME = "aether_dev"
|
|
DB_URI = f"mysql://{DB_USER}:{DB_PASS}@{DB_SERVER}:{DB_PORT}/{DB_NAME}"
|
|
|
|
# Mock the db object before importing lib_schema_v3
|
|
from app.db_sql import db
|
|
db.engine = sqlalchemy.create_engine(DB_URI)
|
|
|
|
from app.lib_schema_v3 import get_object_schema_info
|
|
|
|
def verify_enhanced_schema():
|
|
print("Testing enhanced get_object_schema_info for 'journal'...")
|
|
try:
|
|
info = get_object_schema_info("journal")
|
|
|
|
if "error" in info:
|
|
print(f"Error: {info['error']}")
|
|
return
|
|
|
|
cols = info["database"]["columns"]
|
|
targets = ["name", "enable", "passcode_timeout", "created_on"]
|
|
|
|
print("\n--- Verified Enhanced Metadata ---")
|
|
for col in cols:
|
|
if col["field"] in targets:
|
|
print(f"Field: {col['field']:16} | DB Type: {col['db_type']:15} | Required: {str(col['required']):5} | Default: {col['db_default']}")
|
|
|
|
# Basic check to ensure new keys exist
|
|
assert "db_type" in cols[0]
|
|
assert "required" in cols[0]
|
|
assert "db_default" in cols[0]
|
|
print("\nSuccess: New schema keys are present and populated.")
|
|
|
|
except Exception as e:
|
|
print(f"Test failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
verify_enhanced_schema()
|