mirror of
https://github.com/openkmip/pykmip
synced 2025-12-23 19:53:24 +00:00
Add Attribute class unit tests
This pull request: - Adds the comparison operators to the following classes: -- Attribute.AttributeName class - Fixes bug in the "_create_cryptographic_parameters" function when "None" type parameters are used - Adds read, write, and comparator unit tests for the Attribute class in the /kmip/core/objects.py file Signed-off-by: Hadi Esiely <hadi.esiely-barrera@jhuapl.edu>
This commit is contained in:
@@ -130,24 +130,30 @@ class AttributeValueFactory(object):
|
||||
|
||||
def _create_cryptographic_parameters(self, params):
|
||||
bcm = None
|
||||
if 'block_cipher_mode' in params:
|
||||
bcm = attributes.CryptographicParameters.BlockCipherMode(
|
||||
params.get('block_cipher_mode'))
|
||||
|
||||
padding_method = None
|
||||
if 'padding_method' in params:
|
||||
padding_method = attributes.CryptographicParameters.PaddingMethod(
|
||||
params.get('padding_method'))
|
||||
|
||||
key_role_type = None
|
||||
if 'key_role_type' in params:
|
||||
key_role_type = attributes.CryptographicParameters.KeyRoleType(
|
||||
params.get('key_role_type'))
|
||||
|
||||
hashing_algorithm = None
|
||||
if 'hashing_algorithm' in params:
|
||||
hashing_algorithm = attributes.HashingAlgorithm(
|
||||
params.get("hashing_algorithm"))
|
||||
key_role_type = None
|
||||
|
||||
if params is not None:
|
||||
|
||||
if 'block_cipher_mode' in params:
|
||||
bcm = attributes.CryptographicParameters.BlockCipherMode(
|
||||
params.get('block_cipher_mode'))
|
||||
|
||||
padding_method = None
|
||||
if 'padding_method' in params:
|
||||
padding_method = attributes.CryptographicParameters. \
|
||||
PaddingMethod(params.get('padding_method'))
|
||||
|
||||
key_role_type = None
|
||||
if 'key_role_type' in params:
|
||||
key_role_type = attributes.CryptographicParameters.KeyRoleType(
|
||||
params.get('key_role_type'))
|
||||
|
||||
hashing_algorithm = None
|
||||
if 'hashing_algorithm' in params:
|
||||
hashing_algorithm = attributes.HashingAlgorithm(
|
||||
params.get("hashing_algorithm"))
|
||||
|
||||
return attributes.CryptographicParameters(
|
||||
block_cipher_mode=bcm,
|
||||
|
||||
Reference in New Issue
Block a user