#!/usr/bin/env python3 """ Runner script for the real upload authentication test. This script demonstrates how to run the real functionality test and provides helpful output for debugging. """ import subprocess import sys from pathlib import Path def check_server_running(): """Check if the server is running.""" import requests try: response = requests.get("http://127.0.0.1:8000/api/traces/status", timeout=5) return response.status_code == 200 except: return False def main(): print("๐Ÿš€ RPA Vision V3 - Real Upload Authentication Test Runner") print("=" * 60) # Check if server is running if not check_server_running(): print("โŒ Server is not running!") print("\nTo start the server, run:") print(" python server/api_upload.py") print(" # or") print(" ./run.sh --server") print("\nThen run this test again.") return 1 print("โœ… Server is running") # Run the test print("\n๐Ÿงช Running real functionality test...") try: # Run as pytest result = subprocess.run([ sys.executable, "-m", "pytest", "test_upload_with_hardcoded_token.py::test_real_authentication_upload", "-v", "-s" ], capture_output=False) if result.returncode == 0: print("\n๐ŸŽ‰ All tests passed!") return 0 else: print("\nโŒ Some tests failed.") return result.returncode except KeyboardInterrupt: print("\nโน๏ธ Test interrupted by user") return 1 except Exception as e: print(f"\n๐Ÿ’ฅ Error running test: {e}") # Fallback: run directly print("\n๐Ÿ”„ Trying direct execution...") try: result = subprocess.run([ sys.executable, "test_upload_with_hardcoded_token.py" ], capture_output=False) return result.returncode except Exception as e2: print(f"๐Ÿ’ฅ Direct execution also failed: {e2}") return 1 if __name__ == "__main__": exit(main())