chore(tests): organize test scripts and beautify account creation email
- 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.
This commit is contained in:
47
tests/test_site_lookup.py
Normal file
47
tests/test_site_lookup.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
# Configuration
|
||||
BASE_URL = "https://dev-api.oneskyit.com/v3/crud"
|
||||
FQDN_TO_TEST = "dev-app.oneskyit.com" # Example domain that should exist
|
||||
|
||||
def test_site_domain_lookup():
|
||||
print(f"--- Testing Public Site Domain Lookup: {FQDN_TO_TEST} ---")
|
||||
url = f"{BASE_URL}/site_domain/search"
|
||||
|
||||
# Payload: Search for FQDN, explicitly WITHOUT authentication
|
||||
# The frontend typically sends this to bootstrap
|
||||
query = {
|
||||
"and": [{"field": "fqdn", "op": "eq", "value": FQDN_TO_TEST}]
|
||||
}
|
||||
|
||||
# NO AUTH HEADERS (Simulating unauthenticated bootstrapping)
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, headers=headers, json=query)
|
||||
print(f"URL: {response.url}")
|
||||
print(f"Status Code: {response.status_code}")
|
||||
|
||||
data = response.json()
|
||||
|
||||
if response.status_code == 200:
|
||||
result_data = data.get('data')
|
||||
if isinstance(result_data, list):
|
||||
print(f"Success! Found {len(result_data)} records.")
|
||||
if len(result_data) > 0:
|
||||
print(f"Data: {json.dumps(result_data[0], indent=2)}")
|
||||
else:
|
||||
print(f"Unexpected data format: {type(result_data)}")
|
||||
else:
|
||||
print(f"Failure (Expected before fix). Message: {data.get('status_message')}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error during test: {e}")
|
||||
print("-" * 40 + "\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_site_domain_lookup()
|
||||
Reference in New Issue
Block a user