Files
OSIT-AE-API-FastAPI/tests/e2e/test_e2e_agent_bridge.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

56 lines
1.6 KiB
Python

import requests
import json
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/agent"
def get_headers():
headers = {
"Content-Type": "application/json",
"X-No-Account-ID": "testing-bypass"
}
return headers
def test_endpoint(method, path, description, params=None):
"""
Helper to run a test and print results.
"""
print(f"--- Testing: {description} ---")
url = f"{BASE_URL}{path}"
request_headers = get_headers()
try:
if method == "GET":
response = requests.get(url, headers=request_headers, params=params)
print(f"URL: {response.url}")
print(f"Status Code: {response.status_code}")
data = response.json()
# Check if the result is a list or single object
result_data = data.get('data')
if isinstance(result_data, dict):
print(f"Result Data: {json.dumps(result_data, indent=2)}")
else:
print(f"Result Data (truncated): {str(result_data)[:200]}...")
if response.status_code != 200:
print(f"Error Message: {data.get('status_message')}")
except Exception as e:
print(f"Error during test: {e}")
print("-" * 40 + "\n")
if __name__ == "__main__":
print(f"Starting Aether Agent Bridge Tests against {BASE_URL}\n")
# 1. Get Status
test_endpoint("GET", "/status", "Get Container Status")
# 2. Get Logs (last 5 lines)
test_endpoint("GET", "/logs", "Get Latest Logs", params={"lines": 5})
print("Tests Complete.")