@@ -732,21 +732,32 @@ def test_basic_wrap_unwrap(self):
732
732
unwrapped_message .should_be (b'test message' )
733
733
734
734
735
- TEST_OIDS = {'SPNEGO' : {'bytes' : '\053 \006 \001 \005 \005 \002 ' ,
736
- 'string' : '<OID 1.3.6.1.5.5.2> ' },
737
- 'KRB5' : {'bytes' : '\052 \206 \110 \206 \367 \022 \001 \002 \002 ' ,
738
- 'string' : '<OID 1.2.840.113554.1.2.2> ' },
739
- 'KRB5_OLD' : {'bytes' : '\053 \005 \001 \005 \002 ' ,
740
- 'string' : '<OID 1.3.5.1.5.2> ' },
741
- 'KRB5_WRONG' : {'bytes' : '\052 \206 \110 \202 \367 \022 \001 \002 \002 ' ,
742
- 'string' : '<OID 1.2.840.48018.1.2.2> ' },
743
- 'IAKERB' : {'bytes' : '\053 \006 \001 \005 \002 \005 ' ,
744
- 'string' : '<OID 1.3.6.1.5.2.5> ' }}
735
+ TEST_OIDS = {'SPNEGO' : {'bytes' : b '\053 \006 \001 \005 \005 \002 ' ,
736
+ 'string' : '1.3.6.1.5.5.2' },
737
+ 'KRB5' : {'bytes' : b '\052 \206 \110 \206 \367 \022 \001 \002 \002 ' ,
738
+ 'string' : '1.2.840.113554.1.2.2' },
739
+ 'KRB5_OLD' : {'bytes' : b '\053 \005 \001 \005 \002 ' ,
740
+ 'string' : '1.3.5.1.5.2' },
741
+ 'KRB5_WRONG' : {'bytes' : b '\052 \206 \110 \202 \367 \022 \001 \002 \002 ' ,
742
+ 'string' : '1.2.840.48018.1.2.2' },
743
+ 'IAKERB' : {'bytes' : b '\053 \006 \001 \005 \002 \005 ' ,
744
+ 'string' : '1.3.6.1.5.2.5' }}
745
745
746
746
747
747
class TestOIDTransforms (unittest .TestCase ):
748
748
def test_decode_from_bytes (self ):
749
749
for oid in TEST_OIDS .values ():
750
750
o = gb .OID (elements = oid ['bytes' ])
751
751
text = repr (o )
752
- text .should_be (oid ['string' ])
752
+ text .should_be ("<OID {0}>" .format (oid ['string' ]))
753
+
754
+ def test_encode_from_string (self ):
755
+ for oid in TEST_OIDS .values ():
756
+ o = gb .OID .from_int_seq (oid ['string' ])
757
+ o .__bytes__ ().should_be (oid ['bytes' ])
758
+
759
+ def test_encode_from_int_seq (self ):
760
+ for oid in TEST_OIDS .values ():
761
+ int_seq = oid ['string' ].split ('.' )
762
+ o = gb .OID .from_int_seq (int_seq )
763
+ o .__bytes__ ().should_be (oid ['bytes' ])
0 commit comments