- def testCreate(self):
- d='1.2.643.100.3'
- sn="SNILS"
- long_name="Russian Pension security number"
- o=create(d,sn,long_name)
- self.assertEqual(str(o),d)
- self.assertEqual(o.shortname(),sn)
- self.assertEqual(o.longname(),long_name)
- def testLookup(self):
- d='1.2.643.100.3'
- sn="SNILS"
- long_name="Russian Pension security number"
- o=create(d,sn,long_name)
- x=Oid(sn)
- self.assertEqual(o,x)
- def testCleanup(self):
- d='1.2.643.100.3'
- sn="SNILS"
- long_name="Russian Pension security number"
- o=create(d,sn,long_name)
- cleanup()
- with self.assertRaises(ValueError):
- x=Oid(sn)
- def tearDown(self):
- # Always call cleanup before next test
- cleanup()
-
+ def testCreate(self):
+ d='1.2.643.100.3'
+ sn="SNILS"
+ long_name="Russian Pension security number"
+ o=create(d,sn,long_name)
+ self.assertEqual(str(o),d)
+ self.assertEqual(o.shortname(),sn)
+ self.assertEqual(o.longname(),long_name)
+ def testLookup(self):
+ d='1.2.643.100.3'
+ sn="SNILS"
+ long_name="Russian Pension security number"
+ o=create(d,sn,long_name)
+ x=Oid(sn)
+ self.assertEqual(o,x)
+ def testCleanup(self):
+ d='1.2.643.100.9'
+ sn="SNILX"
+ long_name="Russian Pension security number"
+ o=create(d,sn,long_name)
+ self.assertEqual(str(o),'1.2.643.100.9')
+
+ cleanup()
+ with self.assertRaises(ValueError):
+ x=Oid(sn)
+ def testFromObj(self):
+ from ctypescrypto import libcrypto
+ from ctypes import c_int, c_char_p, c_void_p
+ libcrypto.OBJ_txt2obj.argtypes = (c_char_p, c_int)
+ libcrypto.OBJ_txt2obj.restype = c_void_p
+ obj= libcrypto.OBJ_txt2obj("1.2.643.100.9",1)
+ oid=Oid.fromobj(obj)
+ self.assertEqual(str(oid),'1.2.643.100.9')
+ def tearDown(self):
+ # Always call cleanup before next test
+ cleanup()
+