Merge pull request #401 from OpenKMIP/feat/add-register-name

Update ProxyKmipClient register to support name attributes
This commit is contained in:
Peter Hamilton 2018-03-22 11:27:23 -04:00 committed by GitHub
commit f06014e7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -353,6 +353,14 @@ class ProxyKmipClient(object):
managed_object.operation_policy_name
)
object_attributes.append(opn_attribute)
if hasattr(managed_object, 'names'):
if managed_object.names:
for name in managed_object.names:
name_attribute = self.attribute_factory.create_attribute(
enums.AttributeType.NAME,
name
)
object_attributes.append(name_attribute)
template = cobjects.TemplateAttribute(attributes=object_attributes)
object_type = managed_object.object_type

View File

@ -111,7 +111,9 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
enums.CryptographicAlgorithm.AES,
128,
(b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E'
b'\x0F'))
b'\x0F'),
name="Test Symmetric Key"
)
uid = self.client.register(key)
self.assertIsInstance(uid, six.string_types)