示例#1
0
    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")
示例#2
0
 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}
         )
示例#3
0
    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")
示例#4
0
 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
             })