2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-18 01:03:49 +00:00

Add ObjectType filtering support for the Locate operation

This change updates Locate operation support in the PyKMIP server,
allowing users to filter objects based on the object's Object Type.
Unit tests and integration tests have been added to test and verify
the correctness of this feature.

Additionally, the Locate demo scripts have also been updated to
support Object Type filtering. Simply use the "--object-type" flag
to specify an Object Type enumeration for the Locate script to
filter on.
This commit is contained in:
Peter Hamilton
2019-07-30 15:54:52 -04:00
committed by Peter Hamilton
parent e5de55c0a8
commit d74b394261
7 changed files with 195 additions and 1 deletions

View File

@@ -1359,6 +1359,20 @@ class TestIntegration(testtools.TestCase):
self.assertIn(uid_a, result.uuids)
self.assertIn(uid_b, result.uuids)
# Test locating each key based off of its object type.
result = self.client.locate(
attributes=[
self.attr_factory.create_attribute(
enums.AttributeType.OBJECT_TYPE,
enums.ObjectType.SYMMETRIC_KEY
)
]
)
self.assertEqual(ResultStatus.SUCCESS, result.result_status.value)
self.assertEqual(2, len(result.uuids))
self.assertIn(uid_a, result.uuids)
self.assertIn(uid_b, result.uuids)
# Clean up keys
result = self.client.destroy(uid_a)
self.assertEqual(ResultStatus.SUCCESS, result.result_status.value)