Files
OSIT-AE-API-FastAPI/tests/e2e/test_e2e_v3_event_session.py
Scott Idem a02abbbe4f feat(models): implement Vision ID pattern for event_device and event_session
- Migrated event_device and event_session models to the V3 Vision ID pattern (string-based public IDs).
- Added root_validator for automatic id_random mapping and integer stripping.
- Implemented fields_to_exclude_from_db to protect database updates from convenience/view fields.
- Fixed description_json type in Journal_Base for correct JSON parsing.
- Added E2E verification tests for event_device and event_session V3 endpoints.
2026-01-30 12:38:16 -05:00

60 lines
2.1 KiB
Python

import requests
import json
import sys
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
# Using the API key found in the database
API_KEY = "PHDXUJxx6IgmLNKxIBezTQ"
# Event Session ID found in the database
SESSION_ID = "F0PZd1bNcuD"
def get_headers():
headers = {
"Content-Type": "application/json",
"X-Aether-API-Key": API_KEY,
"X-No-Account-ID": "bypass"
}
return headers
def test_get_event_session():
print(f"--- Testing: Get Event Session by ID ({SESSION_ID}) ---")
url = f"{BASE_URL}/event_session/{SESSION_ID}"
headers = get_headers()
try:
response = requests.get(url, headers=headers)
print(f"URL: {response.url}")
print(f"Status Code: {response.status_code}")
if response.status_code == 200:
data = response.json().get('data', {})
print("✅ SUCCESS: Found Event Session.")
# Verify Vision ID pattern (Strings only for ID fields)
vision_fields = ["id", "event_session_id", "event_id", "event_location_id", "event_track_id", "poc_event_person_id", "poc_person_id"]
for field in vision_fields:
val = data.get(field)
print(f" Field '{field}': {val} (type: {type(val).__name__})")
if val is not None:
assert isinstance(val, str), f"Error: Field '{field}' should be a string, but got {type(val).__name__}"
# Check for any unexpected integer IDs
for key, val in data.items():
if key.endswith("_id") and not key.endswith("external_id"):
if isinstance(val, int):
print(f" ❌ FAILURE: Integer leakage detected in field '{key}': {val}")
else:
print(f"❌ FAILURE: {response.text}")
except Exception as e:
print(f"Error during test: {e}")
print("-" * 40 + "\n")
if __name__ == "__main__":
print(f"Starting Aether V3 Event Session E2E Tests against {BASE_URL}\n")
test_get_event_session()
print("Tests Complete.")