source .venv/bin/activate
pip install -e ".[dev]"
make test| Command | Description | AWS Required |
|---|---|---|
make test |
All unit tests | No |
make test-unit |
Unit tests only | No |
make test-integration |
Integration tests | Yes |
make test-smoke |
Smoke test with real Lambda | Yes |
make test-bulk-dry-run |
Bulk scan dry-run test | Yes |
make test-coverage |
Tests with coverage report | No |
Run without AWS credentials using moto mocking:
make test-unit| File | Tests | Coverage |
|---|---|---|
tests/unit/test_validators.py |
33 | Validation functions |
tests/unit/test_bulk_scan.py |
19 | Bulk scan logic |
tests/unit/test_lambda_function.py |
13 | Scanner Lambda |
Require deployed stack and AWS credentials:
export AWS_REGION=us-east-1
export STACK_NAME=qualys-lambda-scanner
make test-integrationDeploys a test Lambda, invokes scanner, verifies scan:
make test-smokeTests bulk scanning without actually scanning:
make test-bulk-dry-runexport QUALYS_ACCESS_TOKEN="your-token"
export QUALYS_POD="US2"
make validateChecks:
- AWS credentials valid
- Qualys token format
- QScanner binary exists
- CloudFormation templates valid
- Region format valid
make test-coverageGenerates HTML report in htmlcov/.
Sample events in tests/fixtures/events.py:
SAMPLE_CREATE_FUNCTION_EVENTSAMPLE_UPDATE_CODE_EVENTSAMPLE_BULK_SCAN_EVENTSAMPLE_CONTAINER_IMAGE_EVENT
- Unit tests go in
tests/unit/ - Integration tests go in
tests/integration/ - Mark tests with
@pytest.mark.unitor@pytest.mark.integration - Use fixtures from
tests/conftest.py