Files
OSIT-AE-API-FastAPI/tests/archive/test_e2e_v3_nested_advanced.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

81 lines
2.5 KiB
Python

import requests
import json
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
API_KEY = "PMM4n50teUCaOMMTN8qOJA"
ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q" # OSIT
def test_nested_search():
print("--- Testing Nested Advanced Search (POST) ---")
# Test: Search for journals belonging to a specific person
parent_type = "person"
parent_id = "--ghJX-ztEM" # Using a valid person ID
child_type = "journal"
url = f"{BASE_URL}/{parent_type}/{parent_id}/{child_type}/search"
headers = {
"X-Aether-API-Key": API_KEY,
"x-account-id": ACCOUNT_ID
}
search_query = {
"and_filters": [
{"field": "name", "op": "like", "value": "%"}
]
}
try:
response = requests.post(url, headers=headers, json=search_query)
print(f"Status: {response.status_code}")
if response.status_code == 200:
data = response.json().get("data", [])
print(f"✅ Success: Found {len(data)} nested records via search.")
return True
else:
print(f"❌ Failed: {response.text}")
return False
except Exception as e:
print(f"💥 Exception: {e}")
return False
def test_nested_view():
print("\n--- Testing Nested Get with View Parameter ---")
# Test: Get a single journal entry under a journal using 'enriched' view
parent_type = "journal"
parent_id = "PJRCGHQWERT" # Using a known journal ID
child_type = "journal_entry"
child_id = "PJRCGHQWERT" # Using a known entry ID
url = f"{BASE_URL}/{parent_type}/{parent_id}/{child_type}/{child_id}?view=enriched"
headers = {
"X-Aether-API-Key": API_KEY,
"x-account-id": ACCOUNT_ID
}
try:
response = requests.get(url, headers=headers)
print(f"Status: {response.status_code}")
if response.status_code == 200:
print("✅ Success: Retrieved nested record with view=enriched.")
return True
elif response.status_code == 404:
print("⚠️ Note: Record not found, but route matched.")
return True
else:
print(f"❌ Failed: {response.status_code}")
return False
except Exception as e:
print(f"💥 Exception: {e}")
return False
if __name__ == "__main__":
s1 = test_nested_search()
s2 = test_nested_view()
if s1 and s2:
print("\n🎉 NESTED V3 FEATURES VERIFIED!")