mirror of https://github.com/OpenKMIP/PyKMIP.git
Update the payload factories to support new attribute operations
This change updates the request and response payload factories to add support for the Set, Modify, and DeleteAttribute payloads. Unit tests have been added to cover the changes. Partially implements #547
This commit is contained in:
parent
4e59a8a1f0
commit
48350a4166
|
@ -46,6 +46,8 @@ class PayloadFactory():
|
||||||
return self._create_get_attribute_list_payload()
|
return self._create_get_attribute_list_payload()
|
||||||
elif operation is enums.Operation.ADD_ATTRIBUTE:
|
elif operation is enums.Operation.ADD_ATTRIBUTE:
|
||||||
return self._create_add_attribute_payload()
|
return self._create_add_attribute_payload()
|
||||||
|
elif operation is enums.Operation.SET_ATTRIBUTE:
|
||||||
|
return self._create_set_attribute_payload()
|
||||||
elif operation is enums.Operation.MODIFY_ATTRIBUTE:
|
elif operation is enums.Operation.MODIFY_ATTRIBUTE:
|
||||||
return self._create_modify_attribute_payload()
|
return self._create_modify_attribute_payload()
|
||||||
elif operation is enums.Operation.DELETE_ATTRIBUTE:
|
elif operation is enums.Operation.DELETE_ATTRIBUTE:
|
||||||
|
@ -144,6 +146,9 @@ class PayloadFactory():
|
||||||
def _create_add_attribute_payload(self):
|
def _create_add_attribute_payload(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def _create_set_attribute_payload(self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
def _create_modify_attribute_payload(self):
|
def _create_modify_attribute_payload(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from kmip.core.messages import payloads
|
||||||
|
|
||||||
class RequestPayloadFactory(PayloadFactory):
|
class RequestPayloadFactory(PayloadFactory):
|
||||||
|
|
||||||
|
# TODO (peterhamilton) Alphabetize these
|
||||||
def _create_create_payload(self):
|
def _create_create_payload(self):
|
||||||
return payloads.CreateRequestPayload()
|
return payloads.CreateRequestPayload()
|
||||||
|
|
||||||
|
@ -52,6 +53,15 @@ class RequestPayloadFactory(PayloadFactory):
|
||||||
def _create_get_attributes_payload(self):
|
def _create_get_attributes_payload(self):
|
||||||
return payloads.GetAttributesRequestPayload()
|
return payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
|
def _create_delete_attribute_payload(self):
|
||||||
|
return payloads.DeleteAttributeRequestPayload()
|
||||||
|
|
||||||
|
def _create_set_attribute_payload(self):
|
||||||
|
return payloads.SetAttributeRequestPayload()
|
||||||
|
|
||||||
|
def _create_modify_attribute_payload(self):
|
||||||
|
return payloads.ModifyAttributeRequestPayload()
|
||||||
|
|
||||||
def _create_destroy_payload(self):
|
def _create_destroy_payload(self):
|
||||||
return payloads.DestroyRequestPayload()
|
return payloads.DestroyRequestPayload()
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from kmip.core.messages import payloads
|
||||||
|
|
||||||
class ResponsePayloadFactory(PayloadFactory):
|
class ResponsePayloadFactory(PayloadFactory):
|
||||||
|
|
||||||
|
# TODO (peterhamilton) Alphabetize these
|
||||||
def _create_create_payload(self):
|
def _create_create_payload(self):
|
||||||
return payloads.CreateResponsePayload()
|
return payloads.CreateResponsePayload()
|
||||||
|
|
||||||
|
@ -52,6 +53,15 @@ class ResponsePayloadFactory(PayloadFactory):
|
||||||
def _create_get_attributes_payload(self):
|
def _create_get_attributes_payload(self):
|
||||||
return payloads.GetAttributesResponsePayload()
|
return payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
|
def _create_delete_attribute_payload(self):
|
||||||
|
return payloads.DeleteAttributeResponsePayload()
|
||||||
|
|
||||||
|
def _create_set_attribute_payload(self):
|
||||||
|
return payloads.SetAttributeResponsePayload()
|
||||||
|
|
||||||
|
def _create_modify_attribute_payload(self):
|
||||||
|
return payloads.ModifyAttributeResponsePayload()
|
||||||
|
|
||||||
def _create_destroy_payload(self):
|
def _create_destroy_payload(self):
|
||||||
return payloads.DestroyResponsePayload()
|
return payloads.DestroyResponsePayload()
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,12 @@ class TestPayloadFactory(testtools.TestCase):
|
||||||
enums.Operation.DELETE_ATTRIBUTE
|
enums.Operation.DELETE_ATTRIBUTE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_create_set_attribute_payload(self):
|
||||||
|
self._test_not_implemented(
|
||||||
|
self.factory.create,
|
||||||
|
enums.Operation.SET_ATTRIBUTE
|
||||||
|
)
|
||||||
|
|
||||||
def test_create_obtain_lease_payload(self):
|
def test_create_obtain_lease_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
self.factory.create,
|
self.factory.create,
|
||||||
|
|
|
@ -105,16 +105,16 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_modify_attribute_payload(self):
|
def test_create_modify_attribute_payload(self):
|
||||||
self._test_not_implemented(
|
payload = self.factory.create(enums.Operation.MODIFY_ATTRIBUTE)
|
||||||
self.factory.create,
|
self.assertIsInstance(payload, payloads.ModifyAttributeRequestPayload)
|
||||||
enums.Operation.MODIFY_ATTRIBUTE
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_create_delete_attribute_payload(self):
|
def test_create_delete_attribute_payload(self):
|
||||||
self._test_not_implemented(
|
payload = self.factory.create(enums.Operation.DELETE_ATTRIBUTE)
|
||||||
self.factory.create,
|
self.assertIsInstance(payload, payloads.DeleteAttributeRequestPayload)
|
||||||
enums.Operation.DELETE_ATTRIBUTE
|
|
||||||
)
|
def test_create_set_attribute_payload(self):
|
||||||
|
payload = self.factory.create(enums.Operation.SET_ATTRIBUTE)
|
||||||
|
self.assertIsInstance(payload, payloads.SetAttributeRequestPayload)
|
||||||
|
|
||||||
def test_create_obtain_lease_payload(self):
|
def test_create_obtain_lease_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
|
|
@ -105,16 +105,16 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_modify_attribute_payload(self):
|
def test_create_modify_attribute_payload(self):
|
||||||
self._test_not_implemented(
|
payload = self.factory.create(enums.Operation.MODIFY_ATTRIBUTE)
|
||||||
self.factory.create,
|
self.assertIsInstance(payload, payloads.ModifyAttributeResponsePayload)
|
||||||
enums.Operation.MODIFY_ATTRIBUTE
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_create_delete_attribute_payload(self):
|
def test_create_delete_attribute_payload(self):
|
||||||
self._test_not_implemented(
|
payload = self.factory.create(enums.Operation.DELETE_ATTRIBUTE)
|
||||||
self.factory.create,
|
self.assertIsInstance(payload, payloads.DeleteAttributeResponsePayload)
|
||||||
enums.Operation.DELETE_ATTRIBUTE
|
|
||||||
)
|
def test_create_set_attribute_payload(self):
|
||||||
|
payload = self.factory.create(enums.Operation.SET_ATTRIBUTE)
|
||||||
|
self.assertIsInstance(payload, payloads.SetAttributeResponsePayload)
|
||||||
|
|
||||||
def test_create_obtain_lease_payload(self):
|
def test_create_obtain_lease_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
|
Loading…
Reference in New Issue