the-custodian/docs/changes/2026-11-01-scanner-json-digest/attempt-r4-stream/test_stream_diagnostic.py
codex dfd7ee5f30
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
Reject generated-only commits / generated-commit-guard (push) Successful in 13s
Record approved scanner revision 5 and verified cached-stream correction
2026-11-02 11:31:44 +01:00

14 lines
897 B
Python

from pathlib import Path
import importlib.util,unittest
p=Path(__file__).resolve().parent/'diagnose_stream.py';s=importlib.util.spec_from_file_location('stream',p);d=importlib.util.module_from_spec(s);s.loader.exec_module(d)
class Tests(unittest.TestCase):
def test_only_exact_public_marker_is_accepted(self):
self.assertTrue(d.marker(b'{"cached_artifacts_verified":true}\n'))
for raw in [None,b'PRIVATE_SENTINEL',b'{"cached_artifacts_verified":false}',b'{"cached_artifacts_verified":true,"extra":"PRIVATE_SENTINEL"}']:
self.assertFalse(d.marker(raw))
def test_probe_does_not_read_input_or_modify_artifacts(self):
script=d.check_script({})
for command in ['chmod ','mkdir ','cp ','mv ','rm ','cat >','cat >/']:
self.assertNotIn(command,script)
self.assertIn('.migration-owner',script)
if __name__=='__main__':unittest.main()