test(api-v3): update E2E tests for ID Vision, hash-downloads, and data_store parity

This commit is contained in:
Scott Idem
2026-02-03 15:34:12 -05:00
parent 5eaae99702
commit 54d6bd8864
2 changed files with 97 additions and 72 deletions

View File

@@ -3,32 +3,44 @@ import json
# Configuration
BASE_URL = "https://dev-api.oneskyit.com/v3/action/hosted_file"
API_KEY = "IDF68Em5X4HTZlswRNgepQ"
ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q"
API_KEY = "PMM4n50teUCaOMMTN8qOJA"
ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q" # OSIT
# This file was created during our earlier upload tests
VALID_FILE_ID = "2R06T6yuQLw"
# Use a known site key from the DB for the bypass test
# SITE_KEY = "..."
# IDs for testing ID Vision resolution
HOSTED_FILE_ID = "PUwhbT2tMgU"
EVENT_FILE_ID = "cFyCd7FPZe9"
ARCHIVE_CONTENT_ID = "UjKzrk-GKu5"
def test_download_standard():
print(f"--- Testing Standard Download via V3 Action: {VALID_FILE_ID} ---")
url = f"{BASE_URL}/{VALID_FILE_ID}/download"
headers = {
"X-Aether-API-Key": API_KEY,
"x-account-id": ACCOUNT_ID
}
# Hash for testing content-addressable storage
FILE_HASH = "384fef832fa07b347a1d70927d0606b24cf41771202c1bfa00d7026764db2bb2"
def test_download_by_id(label, test_id):
print(f"--- Testing Download via {label}: {test_id} ---")
url = f"{BASE_URL}/{test_id}/download"
headers = {"X-Aether-API-Key": API_KEY, "x-account-id": ACCOUNT_ID}
try:
# We don't want to download the whole binary in a test, so we'll check headers
response = requests.get(url, headers=headers, stream=True)
print(f"Status: {response.status_code}")
print(f"Content-Type: {response.headers.get('Content-Type')}")
print(f"Content-Length: {response.headers.get('Content-Length')}")
if response.status_code == 200:
print("✅ Success: Standard download works.")
print(f"✅ Success: Download via {label} works.")
return True
else:
print(f"❌ Failed: {response.text}")
return False
except Exception as e:
print(f"💥 Exception: {e}")
return False
def test_download_by_hash_query():
print(f"\n--- Testing Hash Download via Query Param API Key ---")
url = f"{BASE_URL}/hash/{FILE_HASH}/download?api_key={API_KEY}"
try:
response = requests.get(url)
print(f"Status: {response.status_code}")
if response.status_code == 200:
print("✅ Success: Hash download with query param works.")
return True
else:
print(f"❌ Failed: {response.text}")
@@ -38,9 +50,8 @@ def test_download_standard():
return False
def test_download_streaming():
print(f"\n--- Testing Byte-Range Streaming: {VALID_FILE_ID} ---")
url = f"{BASE_URL}/{VALID_FILE_ID}/download"
print(f"\n--- Testing Byte-Range Streaming ---")
url = f"{BASE_URL}/{HOSTED_FILE_ID}/download"
headers = {
"X-Aether-API-Key": API_KEY,
"x-account-id": ACCOUNT_ID,
@@ -50,8 +61,6 @@ def test_download_streaming():
try:
response = requests.get(url, headers=headers)
print(f"Status: {response.status_code} (Expected 206)")
print(f"Content-Range: {response.headers.get('Content-Range')}")
if response.status_code == 206:
print("✅ Success: Byte-range streaming works.")
return True
@@ -63,9 +72,15 @@ def test_download_streaming():
return False
if __name__ == "__main__":
s1 = test_download_standard()
s2 = test_download_streaming()
if s1 and s2:
print("\n🎉 ALL DOWNLOAD ACTION TESTS PASSED!")
results = [
test_download_by_id("Hosted File", HOSTED_FILE_ID),
test_download_by_id("Event File (ID Vision)", EVENT_FILE_ID),
test_download_by_id("Archive Content (ID Vision)", ARCHIVE_CONTENT_ID),
test_download_by_hash_query(),
test_download_streaming()
]
if all(results):
print("\n🎉 ALL DOWNLOAD PATTERNS VERIFIED!")
else:
print("\n❌ SOME TESTS FAILED.")
print("\n❌ SOME TESTS FAILED.")