diff --git a/test_device_health.py b/test_device_health.py index 5602671..a9f3484 100644 --- a/test_device_health.py +++ b/test_device_health.py @@ -183,49 +183,6 @@ def test_device_list(): except Exception as e: print(f"āŒ Unexpected error: {e}") -def test_alert_rules(): - """Check if there are any device offline alert rules configured""" - print("\nāš ļø Checking Device Offline Alert Rules") - print("-" * 40) - - try: - response = requests.get(f"{API_BASE_URL}/alerts/rules", headers=get_auth_headers(), verify=False, timeout=10) - - if response.status_code == 200: - data = response.json() - if data.get('success') and data.get('data'): - rules = data['data'] - offline_rules = [] - - for rule in rules: - conditions = rule.get('conditions', {}) - if conditions.get('device_offline'): - offline_rules.append(rule) - - if offline_rules: - print(f"šŸ“‹ Found {len(offline_rules)} device offline alert rules:") - for rule in offline_rules: - print(f" šŸ“Œ Rule: {rule['name']}") - print(f" Description: {rule.get('description', 'No description')}") - print(f" Active: {rule.get('is_active', False)}") - print(f" Channels: {rule.get('alert_channels', [])}") - if rule.get('sms_phone_number'): - print(f" SMS: {rule['sms_phone_number']}") - print() - else: - print("āš ļø No device offline alert rules found!") - print(" You may want to create alert rules for device offline monitoring.") - else: - print(f"āŒ No alert rules found") - else: - print(f"āŒ HTTP Error: {response.status_code}") - print(f" Response: {response.text}") - - except requests.exceptions.RequestException as e: - print(f"āŒ Network error: {e}") - except Exception as e: - print(f"āŒ Unexpected error: {e}") - def main(): print("šŸ„ DEVICE HEALTH MONITORING TEST") print("=" * 60) @@ -239,15 +196,15 @@ def main(): print("āŒ Authentication failed, some tests may not work") print() - # Run all tests + # Run relevant tests only test_device_health_status() test_device_list() - test_alert_rules() test_manual_health_check() print("\n" + "=" * 60) print("šŸ Device Health Monitoring Test Complete") print("=" * 60) + print("ā„¹ļø Note: Alert rules are managed by the backend service automatically") if __name__ == "__main__": main()