- Moved scattered Python test scripts from root and 'admin/development/' to 'tests/'. - Beautified the HTML email body for account creation links in 'app/methods/person_methods.py' with a modern responsive design.
50 lines
1.8 KiB
Python
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")
|