Skip to content

Commit 5198c9b

Browse files
committed
Add integration tests, security/QAT workflows, and SDK framework README
- tests/unit/: 55 unit tests for email validation, schedule helpers, CSV parsing - tests/integration/: 71 integration tests covering DAST request script, blacklist script, bash syntax validation, shellcheck, XML API scripts, and live API connectivity (credential-gated) - tests/fixtures/: allowlist, blacklist, glblacklist CSV fixtures for test runs - pytest.ini, requirements-test.txt: test runner configuration - .github/workflows/integration-tests.yml: unit + integration + shell + API tests, split into jobs with artifact uploads and optional live API job on main - .github/workflows/security-scan.yml: Bandit, ShellCheck, Gitleaks, pip-audit, Semgrep, and credentials-file checker; scheduled weekly - .github/workflows/qat.yml: flake8, ShellCheck lint, JSON/YAML validation, PSScriptAnalyzer on Windows, full test suite with result publishing - README.md: rewritten with badge table, SDK framework overview, API reference, quick-start, test docs, and secrets guide - .gitignore: excludes __pycache__, credentials, test artifacts, coverage files https://claude.ai/code/session_015pBhzcxzBhLcAujgXrwsaz
1 parent 18edc4c commit 5198c9b

20 files changed

Lines changed: 2028 additions & 10 deletions
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "claude/**"
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
# ── Unit tests: pure logic, no external dependencies ───────────────────────
14+
unit-tests:
15+
name: Unit Tests (Python)
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python 3.11
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
cache: pip
26+
27+
- name: Install test dependencies
28+
run: pip install -r requirements-test.txt
29+
30+
- name: Run unit tests
31+
run: pytest tests/unit/ -v --tb=short --junit-xml=unit-test-results.xml
32+
33+
- name: Upload unit test results
34+
uses: actions/upload-artifact@v4
35+
if: always()
36+
with:
37+
name: unit-test-results
38+
path: unit-test-results.xml
39+
40+
# ── Integration tests: scripts invoked end-to-end (no API creds needed) ───
41+
python-integration-tests:
42+
name: Python Script Integration Tests
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
48+
- name: Set up Python 3.11
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.11"
52+
cache: pip
53+
54+
- name: Install test dependencies
55+
run: pip install -r requirements-test.txt
56+
57+
- name: Run Python integration tests
58+
run: |
59+
pytest tests/integration/ \
60+
--ignore=tests/integration/test_api_connectivity.py \
61+
--ignore=tests/integration/test_shell_scripts.py \
62+
-v --tb=short \
63+
--junit-xml=integration-test-results.xml
64+
65+
- name: Upload integration test results
66+
uses: actions/upload-artifact@v4
67+
if: always()
68+
with:
69+
name: integration-test-results
70+
path: integration-test-results.xml
71+
72+
# ── Shell script integration tests (bash syntax + shellcheck) ─────────────
73+
shell-integration-tests:
74+
name: Shell Script Tests
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout repository
78+
uses: actions/checkout@v4
79+
80+
- name: Install shellcheck
81+
run: sudo apt-get update -q && sudo apt-get install -y shellcheck
82+
83+
- name: Set up Python 3.11
84+
uses: actions/setup-python@v5
85+
with:
86+
python-version: "3.11"
87+
88+
- name: Install test dependencies
89+
run: pip install -r requirements-test.txt
90+
91+
- name: Run shell script tests
92+
run: |
93+
pytest tests/integration/test_shell_scripts.py \
94+
-v --tb=short \
95+
--junit-xml=shell-test-results.xml
96+
97+
- name: Upload shell test results
98+
uses: actions/upload-artifact@v4
99+
if: always()
100+
with:
101+
name: shell-test-results
102+
path: shell-test-results.xml
103+
104+
# ── Combined coverage report ───────────────────────────────────────────────
105+
coverage:
106+
name: Test Coverage
107+
runs-on: ubuntu-latest
108+
needs: [unit-tests, python-integration-tests]
109+
steps:
110+
- name: Checkout repository
111+
uses: actions/checkout@v4
112+
113+
- name: Set up Python 3.11
114+
uses: actions/setup-python@v5
115+
with:
116+
python-version: "3.11"
117+
118+
- name: Install dependencies
119+
run: pip install -r requirements-test.txt
120+
121+
- name: Run tests with coverage
122+
run: |
123+
pytest tests/ \
124+
--ignore=tests/integration/test_api_connectivity.py \
125+
--cov=Scripts \
126+
--cov-report=xml \
127+
--cov-report=term-missing \
128+
-q
129+
continue-on-error: true
130+
131+
- name: Upload coverage report
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: coverage-report
135+
path: coverage.xml
136+
137+
# ── Live API connectivity tests (main branch + secrets only) ───────────────
138+
api-connectivity-tests:
139+
name: Veracode API Connectivity
140+
runs-on: ubuntu-latest
141+
if: >
142+
github.event_name == 'push' &&
143+
github.ref == 'refs/heads/main' &&
144+
secrets.VERACODE_API_ID != ''
145+
environment: veracode-integration
146+
steps:
147+
- name: Checkout repository
148+
uses: actions/checkout@v4
149+
150+
- name: Set up Python 3.11
151+
uses: actions/setup-python@v5
152+
with:
153+
python-version: "3.11"
154+
155+
- name: Install dependencies
156+
run: |
157+
pip install -r requirements-test.txt
158+
pip install veracode-api-signing 2>/dev/null || true
159+
160+
- name: Configure Veracode credentials
161+
run: |
162+
mkdir -p ~/.veracode
163+
printf '[default]\nveracode_api_key_id = %s\nveracode_api_key_secret = %s\n' \
164+
"$VERACODE_API_ID" "$VERACODE_API_KEY" > ~/.veracode/credentials
165+
env:
166+
VERACODE_API_ID: ${{ secrets.VERACODE_API_ID }}
167+
VERACODE_API_KEY: ${{ secrets.VERACODE_API_KEY }}
168+
169+
- name: Run API connectivity tests
170+
env:
171+
VERACODE_API_ID: ${{ secrets.VERACODE_API_ID }}
172+
VERACODE_API_KEY: ${{ secrets.VERACODE_API_KEY }}
173+
run: |
174+
pytest tests/integration/test_api_connectivity.py \
175+
-m api -v --tb=short \
176+
--junit-xml=api-test-results.xml
177+
continue-on-error: true
178+
179+
- name: Upload API test results
180+
uses: actions/upload-artifact@v4
181+
if: always()
182+
with:
183+
name: api-test-results
184+
path: api-test-results.xml

0 commit comments

Comments
 (0)