2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-31 23:53:52 +00:00

Update the Register payloads

This change updates the Register payloads to the current payload
format, adding properties for different payload attributes and
adding comparison and string operators. Changes are also made to
the PyKMIP clients and the surrounding testing infrastructure to
reflect the payload changes. An official unit test suite for the
Register payloads has also been included, which will eventually
replace the existing Register message tests elsewhere in the test
suite.

This change prepares the Register payloads for future updates to
support KMIP 2.0.
This commit is contained in:
Peter Hamilton
2019-03-04 17:38:26 -05:00
committed by Peter Hamilton
parent 1a723f224d
commit a81233aa2a
11 changed files with 1841 additions and 117 deletions

View File

@@ -3357,7 +3357,7 @@ class TestKmipEngine(testtools.TestCase):
attribute_factory = factory.AttributeFactory()
# Build a SymmetricKey for registration.
object_type = attributes.ObjectType(enums.ObjectType.SYMMETRIC_KEY)
object_type = enums.ObjectType.SYMMETRIC_KEY
template_attribute = objects.TemplateAttribute(
attributes=[
attribute_factory.create_attribute(
@@ -3408,7 +3408,7 @@ class TestKmipEngine(testtools.TestCase):
payload = payloads.RegisterRequestPayload(
object_type=object_type,
template_attribute=template_attribute,
secret=secret
managed_object=secret
)
response_payload = e._process_register(payload)
@@ -3419,7 +3419,7 @@ class TestKmipEngine(testtools.TestCase):
"Processing operation: Register"
)
uid = response_payload.unique_identifier.value
uid = response_payload.unique_identifier
self.assertEqual('1', uid)
# Retrieve the stored object and verify all attributes were set
@@ -3467,7 +3467,7 @@ class TestKmipEngine(testtools.TestCase):
e._data_session = e._data_store_session_factory()
e._logger = mock.MagicMock()
object_type = attributes.ObjectType(enums.ObjectType.SPLIT_KEY)
object_type = enums.ObjectType.SPLIT_KEY
payload = payloads.RegisterRequestPayload(object_type=object_type)
args = (payload, )
@@ -3491,7 +3491,7 @@ class TestKmipEngine(testtools.TestCase):
e._data_session = e._data_store_session_factory()
e._logger = mock.MagicMock()
object_type = attributes.ObjectType(enums.ObjectType.SYMMETRIC_KEY)
object_type = enums.ObjectType.SYMMETRIC_KEY
payload = payloads.RegisterRequestPayload(object_type=object_type)
args = (payload, )
@@ -8337,7 +8337,7 @@ class TestKmipEngine(testtools.TestCase):
attribute_factory = factory.AttributeFactory()
# Build a SymmetricKey for registration.
object_type = attributes.ObjectType(enums.ObjectType.SYMMETRIC_KEY)
object_type = enums.ObjectType.SYMMETRIC_KEY
template_attribute = objects.TemplateAttribute(
attributes=[
attribute_factory.create_attribute(
@@ -8385,7 +8385,7 @@ class TestKmipEngine(testtools.TestCase):
payload = payloads.RegisterRequestPayload(
object_type=object_type,
template_attribute=template_attribute,
secret=secret
managed_object=secret
)
response_payload = e._process_register(payload)
@@ -8396,7 +8396,7 @@ class TestKmipEngine(testtools.TestCase):
"Processing operation: Register"
)
uid = response_payload.unique_identifier.value
uid = response_payload.unique_identifier
self.assertEqual('1', uid)
e._logger.reset_mock()
@@ -8479,7 +8479,7 @@ class TestKmipEngine(testtools.TestCase):
attribute_factory = factory.AttributeFactory()
# Build a SymmetricKey for registration.
object_type = attributes.ObjectType(enums.ObjectType.SYMMETRIC_KEY)
object_type = enums.ObjectType.SYMMETRIC_KEY
template_attribute = objects.TemplateAttribute(
attributes=[
attribute_factory.create_attribute(
@@ -8527,7 +8527,7 @@ class TestKmipEngine(testtools.TestCase):
payload = payloads.RegisterRequestPayload(
object_type=object_type,
template_attribute=template_attribute,
secret=secret
managed_object=secret
)
response_payload = e._process_register(payload)
@@ -8538,7 +8538,7 @@ class TestKmipEngine(testtools.TestCase):
"Processing operation: Register"
)
uuid = response_payload.unique_identifier.value
uuid = response_payload.unique_identifier
self.assertEqual('1', uuid)
e._logger.reset_mock()