- 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.
73 lines
2.4 KiB
Python
73 lines
2.4 KiB
Python
import requests
|
|
import json
|
|
import sys
|
|
|
|
# Configuration
|
|
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
|
|
API_KEY = "PMM4n50teUCaOMMTN8qOJA"
|
|
|
|
def test_search(obj_type, query, description, params=None):
|
|
"""
|
|
Helper to run a search test and print results.
|
|
"""
|
|
print(f"--- Testing: {description} ---")
|
|
url = f"{BASE_URL}/{obj_type}/search"
|
|
|
|
headers = {
|
|
"Content-Type": "application/json",
|
|
"X-Aether-API-Key": API_KEY,
|
|
"x-no-account-id": "bypass"
|
|
}
|
|
|
|
try:
|
|
response = requests.post(url, headers=headers, json=query, params=params)
|
|
print(f"URL: {response.url}")
|
|
print(f"Status Code: {response.status_code}")
|
|
|
|
data = response.json()
|
|
result_data = data.get('data')
|
|
|
|
if response.status_code == 200:
|
|
if isinstance(result_data, list):
|
|
print(f"✅ Success: Found {len(result_data)} items.")
|
|
else:
|
|
print(f"✅ Success: Result type {type(result_data)}")
|
|
else:
|
|
print(f"❌ Failed: {data.get('status_message')}")
|
|
print(f" Details: {json.dumps(data.get('details', {}), indent=2)}")
|
|
|
|
except Exception as e:
|
|
print(f"💥 Error: {e}")
|
|
print("-" * 40 + "\n")
|
|
|
|
if __name__ == "__main__":
|
|
print(f"Starting Aether V3 Search Registry Verification\n")
|
|
|
|
# 1. Standard Search
|
|
test_search("journal", {"q": "%"}, "Standard Search (Fulltext)")
|
|
|
|
# 2. Test newly added searchable field: created_on
|
|
query_date = {
|
|
"and_filters": [
|
|
{"field": "created_on", "op": "gt", "value": "2020-01-01"}
|
|
]
|
|
}
|
|
test_search("journal", query_date, "Search via newly added field: created_on")
|
|
|
|
# 3. Test newly added searchable field: id_random
|
|
# Get a valid ID first
|
|
res = requests.get(f"{BASE_URL}/journal/", headers={"X-Aether-API-Key": API_KEY, "x-no-account-id": "bypass"}, params={"limit": 1})
|
|
if res.status_code == 200 and res.json().get("data"):
|
|
valid_id = res.json()["data"][0]["id"]
|
|
query_id = {
|
|
"and_filters": [
|
|
{"field": "id_random", "op": "eq", "value": valid_id}
|
|
]
|
|
}
|
|
test_search("journal", query_id, f"Search via newly added field: id_random ({valid_id})")
|
|
|
|
# 4. Test Archive Content (Specialized Object)
|
|
test_search("archive_content", {"q": "%"}, "Archive Content Search")
|
|
|
|
print("Tests Complete.")
|