mirror of https://github.com/OpenKMIP/PyKMIP.git
Adding support for the State attribute
This change adds the State attribute, updating the attribute factory to support creating it.
This commit is contained in:
parent
b46de1849e
commit
65ad4c6111
|
@ -620,6 +620,12 @@ class CryptographicUsageMask(Integer):
|
|||
value, Tags.CRYPTOGRAPHIC_USAGE_MASK)
|
||||
|
||||
|
||||
class State(Enumeration):
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(State, self).__init__(enums.State, value, Tags.STATE)
|
||||
|
||||
|
||||
# 3.33
|
||||
class ObjectGroup(TextString):
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class AttributeValueFactory(object):
|
|||
elif name is enums.AttributeType.USAGE_LIMITS:
|
||||
raise NotImplementedError()
|
||||
elif name is enums.AttributeType.STATE:
|
||||
raise NotImplementedError()
|
||||
return attributes.State(value)
|
||||
elif name is enums.AttributeType.INITIAL_DATE:
|
||||
return primitives.DateTime(value, enums.Tags.INITIAL_DATE)
|
||||
elif name is enums.AttributeType.ACTIVATION_DATE:
|
||||
|
|
|
@ -228,10 +228,12 @@ class TestAttributeValueFactory(testtools.TestCase):
|
|||
"""
|
||||
Test that a State attribute can be created.
|
||||
"""
|
||||
kwargs = {'name': enums.AttributeType.STATE,
|
||||
'value': None}
|
||||
self.assertRaises(
|
||||
NotImplementedError, self.factory.create_attribute_value, **kwargs)
|
||||
state = self.factory.create_attribute_value(
|
||||
enums.AttributeType.STATE,
|
||||
enums.State.ACTIVE
|
||||
)
|
||||
self.assertIsInstance(state, attributes.State)
|
||||
self.assertEqual(enums.State.ACTIVE, state.value)
|
||||
|
||||
def test_create_initial_date(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue