Files
OSIT-AE-API-FastAPI/tests/e2e/test_e2e_v3_event_vision_parity.py
Scott Idem 37c84de57b chore(tests): consolidate E2E test suite into standardized primary scripts
- Combined 10+ one-off tests into 4 primary functional suites (Search, Auth, Lifecycle, Vision).
- Archived original scripts to tests/archive/.
- Updated README with the new standardized inventory.
- Applied clean output formatting across the new suite.
2026-02-03 16:50:18 -05:00

71 lines
2.2 KiB
Python

import requests
import json
# --- Configuration ---
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
# Standard Agent API Key
API_KEY = "PMM4n50teUCaOMMTN8qOJA"
# Test Targets: (Object Type, Valid ID Random)
TARGETS = [
("event_device", "GZvFjgIIZQg"),
("event_session", "F0PZd1bNcuD")
]
def get_headers():
return {
"Content-Type": "application/json",
"X-Aether-API-Key": API_KEY,
"x-no-account-id": "bypass"
}
def verify_vision_parity(obj_type, record_id):
"""
Verifies that the object returns ONLY string IDs for all ID fields (Vision Standard).
"""
print(f"--- Testing {obj_type}: {record_id} ---")
url = f"{BASE_URL}/{obj_type}/{record_id}"
try:
response = requests.get(url, headers=get_headers())
print(f" Status: {response.status_code}")
if response.status_code == 200:
data = response.json().get('data', {})
failures = []
# Check all fields ending in _id (except external_id)
for key, val in data.items():
if key == "id" or (key.endswith("_id") and not key.endswith("external_id")):
if val is not None and not isinstance(val, str):
failures.append(f"{key} is {type(val).__name__} ({val})")
if not failures:
print(f" ✅ Success: All ID fields are strings.")
return True
else:
print(f" ❌ Failure: Integer leakage detected:")
for f in failures:
print(f" - {f}")
return False
else:
print(f" ❌ Error: {response.text[:200]}")
return False
except Exception as e:
print(f" 💥 Exception: {e}")
return False
if __name__ == "__main__":
print(f"Starting Aether V3 Event Vision Parity Tests\n")
results = []
for obj_type, record_id in TARGETS:
results.append(verify_vision_parity(obj_type, record_id))
print("-" * 40)
if all(results):
print("\n🎉 ALL VISION PARITY TESTS PASSED!")
else:
print("\n❌ SOME TESTS FAILED.")