def testSchemaPickling(self): old_asn1 = addon.RelativeOID() serialised = pickle.dumps(old_asn1) assert serialised new_asn1 = pickle.loads(serialised) assert type(new_asn1) == addon.RelativeOID assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self): old_asn1 = addon.RelativeOID('2.3.1.1.2') serialised = pickle.dumps(old_asn1) assert serialised new_asn1 = pickle.loads(serialised) assert new_asn1 == (2, 3, 1, 1, 2)
def testTag(self): assert addon.RelativeOID().tagSet == tag.TagSet( (), tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 0x0d))
def testContains(self): s = addon.RelativeOID('1.3.6.1234.99999') assert 1234 in s assert 4321 not in s
def testInput3(self): assert addon.RelativeOID(addon.RelativeOID('1.3') + (6, )) == (1, 3, 6), 'prettyIn() fails'
def testUnicode(self): s = '1.3.6' if sys.version_info[0] < 3: s = s.decode() assert addon.RelativeOID(s) == (1, 3, 6), 'unicode init fails'
def testInput1(self): assert addon.RelativeOID('1.3.6') == (1, 3, 6), 'prettyIn() fails'
def testRepr(self): assert '1.3.6' in repr(addon.RelativeOID('1.3.6'))
def testLen(self): assert len(addon.RelativeOID((1, 3))) == 2, '__len__() fails'
def testPrefix(self): o = addon.RelativeOID('1.3.6') assert o.isPrefixOf((1, 3, 6)), 'isPrefixOf() fails' assert o.isPrefixOf((1, 3, 6, 1)), 'isPrefixOf() fails' assert not o.isPrefixOf((1, 3)), 'isPrefixOf() fails'
def testRadd(self): assert (1, ) + addon.RelativeOID( (3, 6)) == (1, 3, 6), '__radd__() fails'
def testAdd(self): assert addon.RelativeOID( (1, 3)) + (6, ) == (1, 3, 6), '__add__() fails'
def testEq(self): assert addon.RelativeOID((1, 3, 6)) == (1, 3, 6), '__cmp__() fails'
id_aria128_kw = id_sea + (40, ) id_aria192_kw = id_sea + (41, ) id_aria256_kw = id_sea + (42, ) id_aria128_kwp = id_sea + (43, ) id_aria192_kwp = id_sea + (44, ) id_aria256_kwp = id_sea + (45, ) # Relative OIDs id_pad_null = addon.RelativeOID('0') # no padding algorithms identified id_pad_1 = addon.RelativeOID('1') # padding method 2 of ISO/IEC 9797-1:1999 # Parameters class AriaPadAlgo(univ.Choice): componentType = namedtype.NamedTypes( namedtype.NamedType('specifiedPadAlgo', addon.RelativeOID()), namedtype.NamedType('generalPadAlgo', univ.ObjectIdentifier())) default_aria_pad_algo_null = AriaPadAlgo() default_aria_pad_algo_null['specifiedPadAlgo'] = id_pad_null
def testInput2(self): assert addon.RelativeOID((1, 3, 6)) == (1, 3, 6), 'prettyIn() fails'
class AriaPadAlgo(univ.Choice): componentType = namedtype.NamedTypes( namedtype.NamedType('specifiedPadAlgo', addon.RelativeOID()), namedtype.NamedType('generalPadAlgo', univ.ObjectIdentifier()))
def testStr(self): assert str(addon.RelativeOID((1, 3, 6))) == '1.3.6', 'str() fails'