40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import os
|
|
import json
|
|
from utils.configmanager import (
|
|
load_protected_config,
|
|
get_protected_value,
|
|
get_protected_json,
|
|
PROTECTED_KEYS
|
|
)
|
|
from utils.setup import setup
|
|
|
|
def test_protected_config():
|
|
print("🔒 Testing protected config loading...")
|
|
protected = load_protected_config()
|
|
assert isinstance(protected, dict), "Protected config should be a dictionary"
|
|
for key in PROTECTED_KEYS:
|
|
assert key in protected, f"Missing protected key: {key}"
|
|
print(f"✔ {key} = {protected[key]}")
|
|
|
|
def test_json_parsing():
|
|
print("\n🧪 Testing JSON parsing for POLICY_MAP_ENF_AUD...")
|
|
policy = get_protected_json("POLICY_MAP_ENF_AUD")
|
|
assert isinstance(policy, dict), "POLICY_MAP_ENF_AUD should be a dictionary"
|
|
print(f"✔ POLICY_MAP_ENF_AUD = {json.dumps(policy, indent=2)}")
|
|
|
|
def test_setup_env():
|
|
print("\n⚙️ Running setup() to validate environment setup...")
|
|
working_dir = setup()
|
|
assert working_dir.exists(), "Working directory should exist"
|
|
print(f"✔ Working directory: {working_dir}")
|
|
|
|
print("\n🌍 Checking .env values (excluding protected)...")
|
|
for key in os.environ:
|
|
if key not in PROTECTED_KEYS:
|
|
print(f"🔧 {key} = {os.environ[key]}")
|
|
|
|
if __name__ == "__main__":
|
|
test_protected_config()
|
|
test_json_parsing()
|
|
test_setup_env()
|