示例#1
0
    def test_save_and_load_credentials_persists_statically(self):
        """LocalFileDriver - Save and Load Credentials"""
        raw_credentials = 'aaaa'
        descriptor = 'descriptor'

        encrypted_raw_credentials = encrypt_with_kms(raw_credentials, REGION,
                                                     KMS_ALIAS)

        credentials = Credentials(encrypted_raw_credentials, True, REGION)
        assert_true(self._fs_driver.save_credentials(descriptor, credentials))

        driver2 = LocalFileDriver(
            REGION, 'service')  # Create a separate, identical driver
        loaded_credentials = driver2.load_credentials(descriptor)

        assert_is_not_none(loaded_credentials)
        assert_true(loaded_credentials.is_encrypted())
        assert_equal(loaded_credentials.get_data_kms_decrypted(),
                     raw_credentials.encode())
示例#2
0
 def setup(self):
     LocalFileDriver.clear()
     self._fs_driver = LocalFileDriver(REGION, 'service')
示例#3
0
 def setup(self):
     self.kms_mocker = mock_kms()
     self.kms_mocker.start()
     setup_mock_kms(REGION, KMS_ALIAS)
     LocalFileDriver.clear()
     self._fs_driver = LocalFileDriver(REGION, 'service')