def test_oid_dotted_decimal(self): self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME), 'OID.2.5.4.3') self.assertEqual(nss.oid_tag('OID.2.5.4.3'), nss.SEC_OID_AVA_COMMON_NAME) self.assertEqual(nss.oid_tag('2.5.4.3'), nss.SEC_OID_AVA_COMMON_NAME) self.assertRaises(ValueError, nss.oid_tag, 'OID.99.99.99.99')
def test_oid(self): self.assertEqual(nss.oid_str('2.5.4.3'), 'X520 Common Name') self.assertEqual(nss.oid_str(nss.SEC_OID_AVA_COMMON_NAME), 'X520 Common Name') self.assertEqual(nss.oid_str('SEC_OID_AVA_COMMON_NAME'), 'X520 Common Name') self.assertEqual(nss.oid_str('AVA_COMMON_NAME'), 'X520 Common Name') self.assertEqual(nss.oid_str('cn'), 'X520 Common Name') self.assertEqual(nss.oid_tag_name('2.5.4.3'), 'SEC_OID_AVA_COMMON_NAME') self.assertEqual(nss.oid_tag_name(nss.SEC_OID_AVA_COMMON_NAME), 'SEC_OID_AVA_COMMON_NAME') self.assertEqual(nss.oid_tag_name('SEC_OID_AVA_COMMON_NAME'), 'SEC_OID_AVA_COMMON_NAME') self.assertEqual(nss.oid_tag_name('AVA_COMMON_NAME'), 'SEC_OID_AVA_COMMON_NAME') self.assertEqual(nss.oid_tag_name('cn'), 'SEC_OID_AVA_COMMON_NAME') self.assertEqual(nss.oid_dotted_decimal('2.5.4.3'), 'OID.2.5.4.3') self.assertEqual(nss.oid_dotted_decimal(nss.SEC_OID_AVA_COMMON_NAME), 'OID.2.5.4.3') self.assertEqual(nss.oid_dotted_decimal('SEC_OID_AVA_COMMON_NAME'), 'OID.2.5.4.3') self.assertEqual(nss.oid_dotted_decimal('AVA_COMMON_NAME'), 'OID.2.5.4.3') self.assertEqual(nss.oid_dotted_decimal('cn'), 'OID.2.5.4.3') self.assertEqual(nss.oid_tag('2.5.4.3'), nss.SEC_OID_AVA_COMMON_NAME) self.assertEqual(nss.oid_tag(nss.SEC_OID_AVA_COMMON_NAME), nss.SEC_OID_AVA_COMMON_NAME) self.assertEqual(nss.oid_tag('SEC_OID_AVA_COMMON_NAME'), nss.SEC_OID_AVA_COMMON_NAME) self.assertEqual(nss.oid_tag('AVA_COMMON_NAME'), nss.SEC_OID_AVA_COMMON_NAME) self.assertEqual(nss.oid_tag('cn'), nss.SEC_OID_AVA_COMMON_NAME)