"""Finite image-job command surface; real user-manager execution is separate.""" from pathlib import Path import sys import unittest sys.path.insert(0,str(Path(__file__).resolve().parents[1])) from c01_oci_job import validate_command class ImageJobTests(unittest.TestCase): def setUp(self): self.context={'image_id':'1'*64,'tag':'local/candidate:uat-'+'2'*64, 'reference':'local/candidate@sha256:'+'2'*64} def test_exact_import_and_inspection_commands_only(self): for command in (['info','--format','json'],['load','--input','/dev/stdin'], ['tag',self.context['image_id'],self.context['tag']], ['image','inspect',self.context['reference']]): validate_command(command,self.context) def test_no_lifecycle_cleanup_alternate_store_or_archive_paths(self): for command in (['run','local/candidate'],['start','lnd'],['restart','lnd'], ['rm','-f','lnd'],['system','reset','--force'],['load','--input','/tmp/other.tar'], ['--root','/tmp/other','info','--format','json'], ['image','inspect','other@sha256:'+'3'*64], ['tag',self.context['image_id'],'other:latest']): with self.subTest(command=command),self.assertRaises(ValueError):validate_command(command,self.context) if __name__=='__main__':unittest.main()