Fix jwt-token
This commit is contained in:
@@ -2,19 +2,7 @@
|
||||
"""
|
||||
Orlan Detection Test Script
|
||||
Tests the critical alert system for Orlan military drones by simulating
|
||||
a long-distan try:
|
||||
response = requests.post(f"{API_BASE_URL}/detectors", json=detection_data, headers=get_auth_headers())
|
||||
if response.status_code == 201:
|
||||
status = "🚨 CRITICAL ALERT" if distance_km <= 5 else "⚠️ DETECTED" if is_detectable(distance_km) else "📡 MONITORING"
|
||||
print(f"{status} - Step {step}/{total_steps}: Distance={distance_km:.1f}km, RSSI={rssi:.0f}dBm")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed to send detection: {response.status_code}")
|
||||
print(f"Response: {response.text}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"❌ Error sending detection: {e}")
|
||||
return Falserom undetectable range to directly overhead.
|
||||
a long-distance approach from undetectable range to directly overhead.
|
||||
|
||||
Test Scenario:
|
||||
- Starts 50km away (beyond detection range)
|
||||
@@ -30,7 +18,12 @@ import math
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
# Disable SSL warnings for self-signed certificates
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore', message='Unverified HTTPS request')
|
||||
|
||||
# Configuration from environment variables
|
||||
# Tests default to localhost:3002 for local development
|
||||
API_BASE_URL = os.getenv('API_BASE_URL', 'http://localhost:3002/api')
|
||||
BASE_PATH = os.getenv('VITE_BASE_PATH', '').rstrip('/')
|
||||
|
||||
@@ -60,7 +53,7 @@ def authenticate():
|
||||
|
||||
try:
|
||||
print(f"🔐 Authenticating as user: {USERNAME}")
|
||||
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data)
|
||||
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data, verify=False)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
@@ -127,7 +120,7 @@ def is_detectable(distance_km):
|
||||
def fetch_devices():
|
||||
"""Fetch devices from API"""
|
||||
try:
|
||||
response = requests.get(f"{API_BASE_URL}/devices", headers=get_auth_headers())
|
||||
response = requests.get(f"{API_BASE_URL}/devices", headers=get_auth_headers(), verify=False)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return data.get('data', [])
|
||||
@@ -155,7 +148,7 @@ def send_detection(device, drone_lat, drone_lon, distance_km, step, total_steps)
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(f"{API_BASE_URL}/detectors", json=detection_data)
|
||||
response = requests.post(f"{API_BASE_URL}/detectors", json=detection_data, verify=False)
|
||||
if response.status_code == 201:
|
||||
status = "🚨 CRITICAL ALERT" if distance_km <= 5 else "⚠️ DETECTED" if is_detectable(distance_km) else "📡 MONITORING"
|
||||
print(f"{status} - Step {step}/{total_steps}: Distance={distance_km:.1f}km, RSSI={rssi:.0f}dBm")
|
||||
|
||||
Reference in New Issue
Block a user