<s> import testtools <EOL> from kmip . core import enums <EOL> from kmip . core . messages import contents <EOL> from kmip . services . server import policy <EOL> class TestAttributePolicy ( testtools . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> super ( TestAttributePolicy , self ) . setUp ( ) <EOL> def tearDown ( self ) : <EOL> super ( TestAttributePolicy , self ) . tearDown ( ) <EOL> def test_init ( self ) : <EOL> """<STR_LIT>""" <EOL> policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> def test_is_attribute_supported ( self ) : <EOL> """<STR_LIT>""" <EOL> rules = policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> attribute_a = '<STR_LIT>' <EOL> attribute_b = '<STR_LIT>' <EOL> attribute_c = '<STR_LIT>' <EOL> result = rules . is_attribute_supported ( attribute_a ) <EOL> self . assertTrue ( result ) <EOL> result = rules . is_attribute_supported ( attribute_b ) <EOL> self . assertFalse ( result ) <EOL> result = rules . is_attribute_supported ( attribute_c ) <EOL> self . assertFalse ( result ) <EOL> def test_is_attribute_deprecated ( self ) : <EOL> """<STR_LIT>""" <EOL> rules = policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> attribute_a = '<STR_LIT:Name>' <EOL> attribute_b = '<STR_LIT>' <EOL> result = rules . is_attribute_deprecated ( attribute_a ) <EOL> self . assertFalse ( result ) <EOL> result = rules . is_attribute_deprecated ( attribute_b ) <EOL> self . assertFalse ( result ) <EOL> rules = policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> result = rules . is_attribute_deprecated ( attribute_b ) <EOL> self . assertTrue ( result ) <EOL> def test_is_attribute_applicable_to_object_type ( self ) : <EOL> """<STR_LIT>""" <EOL> rules = policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> attribute = '<STR_LIT>' <EOL> object_type_a = enums . ObjectType . SYMMETRIC_KEY <EOL> object_type_b = enums . ObjectType . OPAQUE_DATA <EOL> result = rules . is_attribute_applicable_to_object_type ( <EOL> attribute , <EOL> object_type_a <EOL> ) <EOL> self . assertTrue ( result ) <EOL> result = rules . is_attribute_applicable_to_object_type ( <EOL> attribute , <EOL> object_type_b <EOL> ) <EOL> self . assertFalse ( result ) <EOL> def test_is_attribute_multivalued ( self ) : <EOL> """<STR_LIT>""" <EOL> rules = policy . AttributePolicy ( contents . ProtocolVersion . create ( <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> attribute_a = '<STR_LIT>' <EOL> attribute_b = '<STR_LIT>' <EOL> result = rules . is_attribute_multivalued ( attribute_a ) <EOL> self . assertFalse ( result ) <EOL> result = rules . is_attribute_multivalued ( attribute_b ) <EOL> self . assertTrue ( result ) </s>
