"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "barbican/tests/plugin/test_store_crypto.py" between
barbican-11.0.0.tar.gz and barbican-12.0.0.tar.gz

About: OpenStack Barbican is the OpenStack Key Manager service. It provides secure storage, provisioning and management of secret data.
The "Wallaby" series (latest release).

test_store_crypto.py  (barbican-11.0.0):test_store_crypto.py  (barbican-12.0.0)
skipping to change at line 229 skipping to change at line 229
secret_dto = self.plugin_to_test.get_secret( secret_dto = self.plugin_to_test.get_secret(
secret_store.SecretType.OPAQUE, secret_store.SecretType.OPAQUE,
None, # Secret metadata is not relevant to store_crypto process. None, # Secret metadata is not relevant to store_crypto process.
self.context) self.context)
# Verify response. # Verify response.
self.assertIsInstance(secret_dto, secret_store.SecretDTO) self.assertIsInstance(secret_dto, secret_store.SecretDTO)
self.assertEqual(secret_store.SecretType.OPAQUE, secret_dto.type) self.assertEqual(secret_store.SecretType.OPAQUE, secret_dto.type)
self.assertEqual( self.assertEqual(
base64.encodestring(self.decrypted_secret).rstrip(b'\n'), base64.encodebytes(self.decrypted_secret).rstrip(b'\n'),
secret_dto.secret) secret_dto.secret)
self.assertEqual( self.assertEqual(
self.encrypted_datum_model.content_type, secret_dto.content_type) self.encrypted_datum_model.content_type, secret_dto.content_type)
self.assertIsInstance(secret_dto.key_spec, secret_store.KeySpec) self.assertIsInstance(secret_dto.key_spec, secret_store.KeySpec)
self.assertEqual( self.assertEqual(
self.secret_model.algorithm, secret_dto.key_spec.alg) self.secret_model.algorithm, secret_dto.key_spec.alg)
self.assertEqual( self.assertEqual(
self.secret_model.bit_length, secret_dto.key_spec.bit_length) self.secret_model.bit_length, secret_dto.key_spec.bit_length)
self.assertEqual( self.assertEqual(
self.secret_model.mode, secret_dto.key_spec.mode) self.secret_model.mode, secret_dto.key_spec.mode)
skipping to change at line 275 skipping to change at line 275
self.assertEqual(self.project_id, test_project_id) self.assertEqual(self.project_id, test_project_id)
@test_utils.parameterized_dataset(dataset_for_pem) @test_utils.parameterized_dataset(dataset_for_pem)
def test_get_secret_encoding(self, input_secret_dto): def test_get_secret_encoding(self, input_secret_dto):
"""Test getting a secret that should be returend in PEM format.""" """Test getting a secret that should be returend in PEM format."""
secret = input_secret_dto.secret secret = input_secret_dto.secret
key_spec = input_secret_dto.key_spec key_spec = input_secret_dto.key_spec
secret_type = input_secret_dto.type secret_type = input_secret_dto.type
decrypt_mock = self.retrieving_plugin.decrypt decrypt_mock = self.retrieving_plugin.decrypt
decrypt_mock.return_value = base64.decodestring(secret) decrypt_mock.return_value = base64.decodebytes(secret)
secret_model = self.context.secret_model secret_model = self.context.secret_model
secret_model.algorithm = key_spec.alg secret_model.algorithm = key_spec.alg
secret_model.bit_length = key_spec.bit_length secret_model.bit_length = key_spec.bit_length
secret_model.mode = key_spec.mode secret_model.mode = key_spec.mode
secret_dto = self.plugin_to_test.get_secret( secret_dto = self.plugin_to_test.get_secret(
secret_type, secret_type,
None, # Secret metadata is not relevant to store_crypto process. None, # Secret metadata is not relevant to store_crypto process.
self.context) self.context)
skipping to change at line 698 skipping to change at line 698
def _verify_encrypted_datum_repository_interactions(self): def _verify_encrypted_datum_repository_interactions(self):
"""Verify the encrypted datum repository interactions.""" """Verify the encrypted datum repository interactions."""
self.assertEqual( self.assertEqual(
1, self.datum_repo.create_from.call_count) 1, self.datum_repo.create_from.call_count)
args, kwargs = self.datum_repo.create_from.call_args args, kwargs = self.datum_repo.create_from.call_args
test_datum_model = args[0] test_datum_model = args[0]
self.assertIsInstance(test_datum_model, models.EncryptedDatum) self.assertIsInstance(test_datum_model, models.EncryptedDatum)
self.assertEqual( self.assertEqual(
self.content_type, test_datum_model.content_type) self.content_type, test_datum_model.content_type)
self.assertEqual( self.assertEqual(
base64.encodestring(self.cypher_text).rstrip(b'\n'), base64.encodebytes(self.cypher_text).rstrip(b'\n'),
test_datum_model.cypher_text) test_datum_model.cypher_text)
self.assertEqual( self.assertEqual(
self.response_dto.kek_meta_extended, self.response_dto.kek_meta_extended,
test_datum_model.kek_meta_extended) test_datum_model.kek_meta_extended)
class WhenTestingStoreCryptoIndicateBindCompleted(TestSecretStoreBase): class WhenTestingStoreCryptoIndicateBindCompleted(TestSecretStoreBase):
"""Tests store_crypto.py's _indicate_bind_completed() function.""" """Tests store_crypto.py's _indicate_bind_completed() function."""
def test_bind_operation(self): def test_bind_operation(self):
kek_meta_dto = base.KEKMetaDTO(self.kek_meta_project_model) kek_meta_dto = base.KEKMetaDTO(self.kek_meta_project_model)
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)