Files
OSIT-AE-API-FastAPI/tests/e2e/test_e2e_v3_schema.py
Scott Idem b2384f2869 Tests: Reorganize test suite into functional subdirectories
- 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.
2026-01-16 10:46:19 -05:00

50 lines
1.8 KiB
Python

import requests
import json
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
ACCOUNT_ID = "nqOzejLCDXM" # Legacy Header Fallback
def get_headers():
return {
"Content-Type": "application/json",
"X-Account-ID": ACCOUNT_ID
}
def test_schema(obj_type):
print(f"--- Testing Schema: {obj_type} ---")
url = f"{BASE_URL}/{obj_type}/schema"
try:
response = requests.get(url, headers=get_headers())
print(f"URL: {response.url}")
print(f"Status Code: {response.status_code}")
data = response.json()
if response.status_code == 200:
print(f"Object Type: {data['data']['object_type']}")
print(f"Database Table: {data['data']['database']['table_name']}")
print(f"Column Count: {len(data['data']['database']['columns'])}")
print(f"Model Name: {data['data']['model']['name']}")
print(f"Model Field Count: {len(data['data']['model']['fields'])}")
# Print a few columns and fields as example
print("\nExample Columns:")
for col in data['data']['database']['columns'][:3]:
print(f" - {col['field']} ({col['type']})")
print("\nExample Model Fields:")
fields = list(data['data']['model']['fields'].keys())
for field in fields[:3]:
f_info = data['data']['model']['fields'][field]
print(f" - {field} (alias: {f_info['alias']}, type: {f_info['type']})")
else:
print(f"Error: {data.get('status_message')}")
except Exception as e:
print(f"Error during test: {e}")
print("-" * 40 + "\n")
if __name__ == "__main__":
test_schema("account")
test_schema("event_badge")