Saving more test scripts
This commit is contained in:
50
tests/e2e/cleanup_test_files.py
Normal file
50
tests/e2e/cleanup_test_files.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
# Configuration
|
||||
BASE_URL = "https://dev-api.oneskyit.com/v3/action/hosted_file"
|
||||
API_KEY = "IDF68Em5X4HTZlswRNgepQ"
|
||||
ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q"
|
||||
LINK_TO_TYPE = "archive_content"
|
||||
LINK_TO_ID = "bZOa7CtUm0E"
|
||||
|
||||
# Files to cleanup
|
||||
FILE_IDS = [
|
||||
"gv6gz5aNw14",
|
||||
"58l61PS8BeQ",
|
||||
"cC4J7C38OCI",
|
||||
"cRFg7qnn3l8",
|
||||
"E0Z0Q1EVX2g",
|
||||
"2R06T6yuQLw"
|
||||
]
|
||||
|
||||
def cleanup_files():
|
||||
print(f"--- Cleaning up Test Files via V3 Action API ---")
|
||||
|
||||
headers = {
|
||||
"X-Aether-API-Key": API_KEY,
|
||||
"x-account-id": ACCOUNT_ID
|
||||
}
|
||||
|
||||
params = {
|
||||
"link_to_type": LINK_TO_TYPE,
|
||||
"link_to_id": LINK_TO_ID,
|
||||
"rm_orphan": "true",
|
||||
"method": "delete"
|
||||
}
|
||||
|
||||
for fid in FILE_IDS:
|
||||
print(f"\nDeleting File: {fid}...")
|
||||
url = f"{BASE_URL}/{fid}"
|
||||
try:
|
||||
response = requests.delete(url, headers=headers, params=params)
|
||||
print(f"Status: {response.status_code}")
|
||||
if response.status_code == 200:
|
||||
print(f"✅ Result: {json.dumps(response.json()['data'], indent=2)}")
|
||||
else:
|
||||
print(f"❌ Failed: {response.text}")
|
||||
except Exception as e:
|
||||
print(f"💥 Exception: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
cleanup_files()
|
||||
Reference in New Issue
Block a user