Files
OSIT-AE-API-FastAPI/tests/e2e/test_e2e_v3_action_scaffold.py

45 lines
1.5 KiB
Python

import requests
import json
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/v3/action/hosted_file"
API_KEY = "IDF68Em5X4HTZlswRNgepQ"
ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q"
def test_scaffold_reachability():
print("--- Testing V3 Action Router Scaffold Reachability ---")
headers = {
"X-Aether-API-Key": API_KEY,
"x-account-id": ACCOUNT_ID
}
# 1. Test Upload Scaffold
print("\n[1] Testing Upload Action Reachability...")
files = [("file_list", ("test.txt", b"content", "text/plain"))]
data = {
"account_id": ACCOUNT_ID,
"link_to_type": "archive_content",
"link_to_id": "bZOa7CtUm0E8hx2FjbQ3C_"
}
resp = requests.post(f"{BASE_URL}/upload", headers=headers, files=files, data=data)
print(f"Status: {resp.status_code}")
if resp.status_code == 200:
print(f"✅ Success: {resp.json().get('status_message')}")
else:
print(f"❌ Failed: {resp.text}")
# 2. Test Download Scaffold with Delay
print("\n[2] Testing Download Action Reachability (with 500ms delay)...")
headers_w_delay = headers.copy()
headers_w_delay["X-Delay-ms"] = "500"
resp = requests.get(f"{BASE_URL}/some_file_id/download", headers=headers_w_delay)
print(f"Status: {resp.status_code}")
if resp.status_code == 200:
print(f"✅ Success: {resp.json().get('status_message')}")
else:
print(f"❌ Failed: {resp.text}")
if __name__ == "__main__":
test_scaffold_reachability()