Skip to content

Commit 73489de

Browse files
committed
Add test to check OID repr returns correct results
Uses known OIDs as test vectors. Signed-off-by: Simo Sorce <[email protected]>
1 parent 2e2c8d8 commit 73489de

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

gssapi/tests/test_raw.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,23 @@ def test_basic_wrap_unwrap(self):
730730
unwrapped_message.should_be_a(bytes)
731731
unwrapped_message.shouldnt_be_empty()
732732
unwrapped_message.should_be(b'test message')
733+
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>'}}
745+
746+
747+
class TestOIDTransforms(unittest.TestCase):
748+
def test_decode_from_bytes(self):
749+
for oid in TEST_OIDS.values():
750+
o = gb.OID(elements=oid['bytes'])
751+
text = repr(o)
752+
text.should_be(oid['string'])

0 commit comments

Comments
 (0)