def test_get_encryptors(self): encryption = { 'control_location': 'front-end', 'provider': 'LuksEncryptor' } encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance(encryptor, luks.LuksEncryptor, "encryptor is not an instance of LuksEncryptor") encryption = { 'control_location': 'front-end', 'provider': 'CryptsetupEncryptor' } encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance( encryptor, cryptsetup.CryptsetupEncryptor, "encryptor is not an instance of" "CryptsetupEncryptor") encryption = { 'control_location': 'front-end', 'provider': 'NoOpEncryptor' } encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance(encryptor, nop.NoOpEncryptor, "encryptor is not an instance of NoOpEncryptor")
def test_error_log(self, log): encryption = {"control_location": "front-end", "provider": "TestEncryptor"} provider = "TestEncryptor" try: encryptors.get_volume_encryptor(self.connection_info, **encryption) except Exception as e: log.error.assert_called_once_with( "Error instantiating " "%(provider)s: " "%(exception)s", {"provider": provider, "exception": e} )
def test_get_encryptors(self): encryption = {"control_location": "front-end", "provider": "LuksEncryptor"} encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance(encryptor, luks.LuksEncryptor, "encryptor is not an instance of LuksEncryptor") encryption = {"control_location": "front-end", "provider": "CryptsetupEncryptor"} encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance( encryptor, cryptsetup.CryptsetupEncryptor, "encryptor is not an instance of" "CryptsetupEncryptor" ) encryption = {"control_location": "front-end", "provider": "NoOpEncryptor"} encryptor = encryptors.get_volume_encryptor(self.connection_info, **encryption) self.assertIsInstance(encryptor, nop.NoOpEncryptor, "encryptor is not an instance of NoOpEncryptor")
def test_error_log(self, log): encryption = { 'control_location': 'front-end', 'provider': 'TestEncryptor' } provider = 'TestEncryptor' try: encryptors.get_volume_encryptor(self.connection_info, **encryption) except Exception as e: log.error.assert_called_once_with( "Error instantiating " "%(provider)s: " "%(exception)s", { 'provider': provider, 'exception': e })