feat(registry): standardize searchable_fields and add developer reminders
- Added id_random, account_id_random, created_on, and updated_on to searchable whitelists. - Standardized field coverage for Core and Other (Archive/HostedFile) modules. - Added Developer Handshake comments to prevent future whitelist/model desync. - Verified via new E2E registry test suite.
This commit is contained in:
72
tests/e2e/test_e2e_v3_registry_verify.py
Normal file
72
tests/e2e/test_e2e_v3_registry_verify.py
Normal file
@@ -0,0 +1,72 @@
|
||||
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.")
|
||||
Reference in New Issue
Block a user