From faa6de866da60c62f77227ff961e39757d90991e Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 3 Feb 2026 12:54:41 -0500 Subject: [PATCH] test(event-file): add E2E test for V3 event_file upload action --- tests/e2e/test_e2e_v3_action_event_file.py | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/e2e/test_e2e_v3_action_event_file.py diff --git a/tests/e2e/test_e2e_v3_action_event_file.py b/tests/e2e/test_e2e_v3_action_event_file.py new file mode 100644 index 0000000..dd1adb4 --- /dev/null +++ b/tests/e2e/test_e2e_v3_action_event_file.py @@ -0,0 +1,74 @@ +import requests +import os + +# Configuration +BASE_URL = "https://dev-api.oneskyit.com/v3/action/event_file" +API_KEY = "IDF68Em5X4HTZlswRNgepQ" +ACCOUNT_ID = "Q8lR8Ai8hx2FjbQ3C_EH1Q" # OSIT + +def test_event_file_upload(): + print("--- Testing Event File Upload via V3 Action ---") + + url = f"{BASE_URL}/upload" + headers = { + "X-Aether-API-Key": API_KEY, + "x-account-id": ACCOUNT_ID + } + + # Create a small dummy file + test_filename = "v3_event_test.txt" + with open(test_filename, "w") as f: + f.write("This is a test file for V3 Event File Action.") + + data = { + "account_id": ACCOUNT_ID, + "for_type": "event", + "for_id": "pjrcghqwert", # IDAA Recovery Meetings + "event_id": "pjrcghqwert", + "title": "V3 Test Upload", + "description": "Uploaded via atomic V3 action" + } + + files = [ + ("file_list", (test_filename, open(test_filename, "rb"), "text/plain")) + ] + + try: + response = requests.post(url, headers=headers, data=data, files=files) + print(f"Status: {response.status_code}") + + if response.status_code == 200: + res_json = response.json() + data_li = res_json.get("data", []) + if data_li: + ef = data_li[0] + print(f"✅ Success: Event File Created!") + print(f" Event File ID: {ef.get('id')}") + print(f" Hosted File ID: {ef.get('hosted_file_id_random')}") + print(f" Filename: {ef.get('filename')}") + + # Cleanup: try downloading it + download_url = f"{BASE_URL}/{ef.get('id')}/download" + print(f"\n--- Testing Download via Event File ID: {ef.get('id')} ---") + dl_resp = requests.get(download_url, headers=headers) + if dl_resp.status_code == 200: + print("✅ Success: Download worked!") + else: + print(f"❌ Download Failed: {dl_resp.status_code}") + + return True + else: + print(f"❌ Failed: No data in response.") + return False + else: + print(f"❌ Failed: {response.text}") + return False + except Exception as e: + print(f"💥 Exception: {e}") + return False + finally: + if os.path.exists(test_filename): + os.remove(test_filename) + +if __name__ == "__main__": + test_event_file_upload()