66"""
77
88import json
9- import os
109import tempfile
1110from pathlib import Path
1211from unittest .mock import AsyncMock , MagicMock , patch
@@ -42,7 +41,7 @@ def test_pattern_structure(self):
4241 def test_severity_values (self ):
4342 """Test that severities are valid values."""
4443 valid_severities = {"critical" , "high" , "medium" , "low" }
45- for vuln_type , info in SECURITY_PATTERNS .items ():
44+ for _vuln_type , info in SECURITY_PATTERNS .items ():
4645 assert info ["severity" ] in valid_severities
4746
4847
@@ -203,7 +202,7 @@ async def test_run_stage_triage(self):
203202 with patch .object (workflow , "_triage" , new_callable = AsyncMock ) as mock :
204203 mock .return_value = ({"findings" : []}, 100 , 50 )
205204
206- result = await workflow .run_stage ("triage" , ModelTier .CHEAP , {"path" : "." })
205+ await workflow .run_stage ("triage" , ModelTier .CHEAP , {"path" : "." })
207206
208207 mock .assert_called_once ()
209208
@@ -215,9 +214,7 @@ async def test_run_stage_analyze(self):
215214 with patch .object (workflow , "_analyze" , new_callable = AsyncMock ) as mock :
216215 mock .return_value = ({"analysis" : {}}, 200 , 100 )
217216
218- result = await workflow .run_stage (
219- "analyze" , ModelTier .CAPABLE , {"findings" : []}
220- )
217+ await workflow .run_stage ("analyze" , ModelTier .CAPABLE , {"findings" : []})
221218
222219 mock .assert_called_once ()
223220
@@ -229,7 +226,7 @@ async def test_run_stage_assess(self):
229226 with patch .object (workflow , "_assess" , new_callable = AsyncMock ) as mock :
230227 mock .return_value = ({"risk_score" : 0 }, 150 , 75 )
231228
232- result = await workflow .run_stage ("assess" , ModelTier .CAPABLE , {})
229+ await workflow .run_stage ("assess" , ModelTier .CAPABLE , {})
233230
234231 mock .assert_called_once ()
235232
@@ -241,7 +238,7 @@ async def test_run_stage_remediate(self):
241238 with patch .object (workflow , "_remediate" , new_callable = AsyncMock ) as mock :
242239 mock .return_value = ({"remediation_plan" : []}, 300 , 200 )
243240
244- result = await workflow .run_stage ("remediate" , ModelTier .PREMIUM , {})
241+ await workflow .run_stage ("remediate" , ModelTier .PREMIUM , {})
245242
246243 mock .assert_called_once ()
247244
@@ -348,7 +345,7 @@ async def test_triage_skips_node_modules(self):
348345 with tempfile .TemporaryDirectory () as tmpdir :
349346 node_dir = Path (tmpdir ) / "node_modules"
350347 node_dir .mkdir ()
351- (node_dir / "lib.js" ).write_text (' eval(user_input)' )
348+ (node_dir / "lib.js" ).write_text (" eval(user_input)" )
352349
353350 workflow = SecurityAuditWorkflow ()
354351
@@ -463,9 +460,7 @@ def get_user(user_id: int) -> Optional[dict]:
463460 )
464461
465462 # Clean code should have minimal findings
466- critical_findings = [
467- f for f in result ["findings" ] if f ["severity" ] == "critical"
468- ]
463+ critical_findings = [f for f in result ["findings" ] if f ["severity" ] == "critical" ]
469464 assert len (critical_findings ) == 0
470465
471466 @pytest .mark .asyncio
0 commit comments