def test_luks2_format_args(self): storage = create_storage() request = PartitioningRequest() request.encrypted = True request.passphrase = "default" request.luks_version = "luks2" request.pbkdf = "argon2i" request.pbkdf_memory = 256 request.pbkdf_iterations = 1000 request.pbkdf_time = 100 args = AutomaticPartitioningTask._get_luks_format_args( storage, request) pbkdf_args = args.pop("pbkdf_args") assert args == { "passphrase": "default", "cipher": "", "luks_version": "luks2", "escrow_cert": None, "add_backup_passphrase": False, } assert isinstance(pbkdf_args, LUKS2PBKDFArgs) assert pbkdf_args.type == "argon2i" assert pbkdf_args.max_memory_kb == 256 assert pbkdf_args.iterations == 1000 assert pbkdf_args.time_ms == 100
def no_luks_format_args_test(self): storage = create_storage() request = PartitioningRequest() args = AutomaticPartitioningTask._get_luks_format_args( storage, request) self.assertEqual(args, {})
def test_no_luks_format_args(self): storage = create_storage() request = PartitioningRequest() args = AutomaticPartitioningTask._get_luks_format_args( storage, request) assert args == {}
def luks1_format_args_test(self): storage = create_storage() storage._escrow_certificates["file:///tmp/escrow.crt"] = "CERTIFICATE" request = PartitioningRequest() request.encrypted = True request.passphrase = "passphrase" request.luks_version = "luks1" request.cipher = "aes-xts-plain64" request.escrow_certificate = "file:///tmp/escrow.crt" request.backup_passphrase_enabled = True args = AutomaticPartitioningTask._get_luks_format_args(storage, request) self.assertEqual(args, { "passphrase": "passphrase", "cipher": "aes-xts-plain64", "luks_version": "luks1", "pbkdf_args": None, "escrow_cert": "CERTIFICATE", "add_backup_passphrase": True, })