بنقرة واحدة
testing-workflow
// Read before running tests. Detailed instructions for single, standard unit tests (fast), full suites (slow), handling authentication, and obtaining the API Token. Tests must be run when a job is complete.
// Read before running tests. Detailed instructions for single, standard unit tests (fast), full suites (slow), handling authentication, and obtaining the API Token. Tests must be run when a job is complete.
NetAlertX coding standards and conventions. Use this when writing code, reviewing code, or implementing features.
Manage NetAlertX configuration settings. Use this when asked to add setting, read config, get_setting_value, ccd, or configure options.
Guide for identifying, managing, and running commands within the NetAlertX development container. Use this when asked to run commands, testing, setup scripts, or troubleshoot container issues.
Enables live interaction with the NetAlertX runtime. This skill configures the Model Context Protocol (MCP) connection, granting full API access for debugging, troubleshooting, and real-time operations including database queries, network scans, and device management.
Enables live interaction with the NetAlertX runtime. This skill configures the Model Context Protocol (MCP) connection, granting full API access for debugging, troubleshooting, and real-time operations including database queries, network scans, and device management.
Develop and extend NetAlertX REST API endpoints. Use this when asked to create endpoint, add API route, implement API, or modify API responses.
| name | testing-workflow |
| description | Read before running tests. Detailed instructions for single, standard unit tests (fast), full suites (slow), handling authentication, and obtaining the API Token. Tests must be run when a job is complete. |
After code is developed, tests must be run to ensure the integrity of the final result.
Crucial: Tests MUST be run inside the container to access the correct runtime environment (DB, Config, Dependencies).
Before running any tests, verify you are inside the development container:
ls -d /workspaces/NetAlertX
IF this directory does not exist, you are likely on the host machine. You MUST immediately activate the devcontainer-management skill to enter the container or run commands inside it.
activate_skill("devcontainer-management")
Unless the user explicitly requests "fast" or "quick" tests, you MUST run the full test suite. Do not optimize for time. Comprehensive coverage is the priority over speed.
cd /workspaces/NetAlertX; pytest test/
ONLY use this if the user explicitly asks for "fast tests", "quick tests", or "unit tests only". This excludes slow tests marked with docker or feature_complete.
cd /workspaces/NetAlertX; pytest test/ -m 'not docker and not feature_complete'
To run a specific file or folder:
cd /workspaces/NetAlertX; pytest test/<path_to_test>
Example:
cd /workspaces/NetAlertX; pytest test/api_endpoints/test_mcp_extended_endpoints.py
Authentication tokens are required to perform certain operations such as manual testing or crafting expressions to work with the web APIs. After making code changes, you MUST reset the environment to ensure the new code is running and verify you have the latest API_TOKEN.
bash /workspaces/NetAlertX/.devcontainer/scripts/setup.sh
sleep 5
python3 -c "from helper import get_setting_value; print(get_setting_value('API_TOKEN'))"
The retrieved token MUST be used in all subsequent API or test calls requiring authentication.
If tests fail with 403 Forbidden or empty tokens:
/workspaces/NetAlertX/.devcontainer/scripts/setup.sh) if required.app.conf inside the container: cat /data/config/app.confpython3 -c "from helper import get_setting_value; print(get_setting_value('API_TOKEN'))"