From 3cb55eb35c7e7642d6c759cfadde63e2df6f971b Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Sun, 11 Jan 2026 12:56:56 +1100 Subject: [PATCH] TEST: linting fixes Signed-off-by: jokob-sk --- test/ui/run_all_tests.py | 8 ++++---- test/ui/test_helpers.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/ui/run_all_tests.py b/test/ui/run_all_tests.py index bf103c85..a2914052 100644 --- a/test/ui/run_all_tests.py +++ b/test/ui/run_all_tests.py @@ -23,9 +23,9 @@ import test_ui_plugins # noqa: E402 [flake8 lint suppression] def main(): """Run all UI tests and provide summary""" - print("\n" + "="*70) + print("\n" + "=" * 70) print("NetAlertX UI Test Suite") - print("="*70) + print("=" * 70) test_modules = [ ("Dashboard", test_ui_dashboard), @@ -49,9 +49,9 @@ def main(): results[name] = False # Summary - print("\n" + "="*70) + print("\n" + "=" * 70) print("Test Summary") - print("="*70 + "\n") + print("=" * 70 + "\n") for name, passed in results.items(): status = "✓" if passed else "✗" diff --git a/test/ui/test_helpers.py b/test/ui/test_helpers.py index 7b93c460..c61f9a3d 100644 --- a/test/ui/test_helpers.py +++ b/test/ui/test_helpers.py @@ -4,7 +4,6 @@ Shared test utilities and configuration """ import os -import pytest import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options @@ -14,6 +13,7 @@ from selenium.webdriver.chrome.service import Service BASE_URL = os.getenv("UI_BASE_URL", "http://localhost:20211") API_BASE_URL = os.getenv("API_BASE_URL", "http://localhost:20212") + def get_api_token(): """Get API token from config file""" config_path = "/data/config/app.conf" @@ -29,14 +29,13 @@ def get_api_token(): print(f"⚠ Config file not found: {config_path}") return None + def get_driver(download_dir=None): """Create a Selenium WebDriver for Chrome/Chromium Args: download_dir: Optional directory for downloads. If None, uses /tmp/selenium_downloads """ - import os - import subprocess # Check if chromedriver exists chromedriver_paths = ['/usr/bin/chromedriver', '/usr/local/bin/chromedriver'] @@ -97,6 +96,7 @@ def get_driver(download_dir=None): traceback.print_exc() return None + def api_get(endpoint, api_token, timeout=5): """Make GET request to API - endpoint should be path only (e.g., '/devices')""" headers = {"Authorization": f"Bearer {api_token}"} @@ -104,6 +104,7 @@ def api_get(endpoint, api_token, timeout=5): url = endpoint if endpoint.startswith('http') else f"{API_BASE_URL}{endpoint}" return requests.get(url, headers=headers, timeout=timeout) + def api_post(endpoint, api_token, data=None, timeout=5): """Make POST request to API - endpoint should be path only (e.g., '/devices')""" headers = {"Authorization": f"Bearer {api_token}"}