From f145662e1f7934676c53ac4c4db43511778b8870 Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Thu, 22 Mar 2018 01:35:41 -0400 Subject: [PATCH] Update ProxyKmipClient register to support name attributes This change updates the ProxyKmipClient support for the Register operation, adding the ability to register Name attributes with the managed object being registered. This matches the functionality available when using the Create operation. Fixes #400 --- kmip/pie/client.py | 8 ++++++++ kmip/tests/integration/services/test_proxykmipclient.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kmip/pie/client.py b/kmip/pie/client.py index 3c5bfc6..b3d8a86 100644 --- a/kmip/pie/client.py +++ b/kmip/pie/client.py @@ -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 diff --git a/kmip/tests/integration/services/test_proxykmipclient.py b/kmip/tests/integration/services/test_proxykmipclient.py index 04c1a73..3c195af 100644 --- a/kmip/tests/integration/services/test_proxykmipclient.py +++ b/kmip/tests/integration/services/test_proxykmipclient.py @@ -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)