Example #1
0
 def test_nid(self):
     assert m2.obj_ln2nid("commonName") == m2.obj_txt2nid(
         "2.5.4.3"), "ln2nid and txt2nid mismatch"
     assert m2.obj_ln2nid("CN") == 0, "ln2nid on sn"
     assert m2.obj_sn2nid("CN") == m2.obj_ln2nid(
         "commonName"), "ln2nid and sn2nid mismatch"
     assert m2.obj_sn2nid("CN") == m2.obj_obj2nid(m2.obj_txt2obj(
         "CN", 0)), "obj2nid"
     assert m2.obj_txt2nid("__unknown") == 0, "__unknown"
Example #2
0
 def test_nid(self):
     self.assertEqual(m2.obj_ln2nid("commonName"),
                      m2.obj_txt2nid("2.5.4.3"),
                      "ln2nid and txt2nid mismatch")
     self.assertEqual(m2.obj_ln2nid("CN"), 0, "ln2nid on sn")
     self.assertEqual(m2.obj_sn2nid("CN"), m2.obj_ln2nid("commonName"),
                      "ln2nid and sn2nid mismatch")
     self.assertEqual(m2.obj_sn2nid("CN"),
                      m2.obj_obj2nid(m2.obj_txt2obj("CN", 0)), "obj2nid")
     self.assertEqual(m2.obj_txt2nid("__unknown"), 0, "__unknown")
Example #3
0
 def test_nid(self):
     self.assertEqual(m2.obj_ln2nid("commonName"),
                      m2.obj_txt2nid("2.5.4.3"),
                      "ln2nid and txt2nid mismatch")
     self.assertEqual(m2.obj_ln2nid("CN"),
                      0, "ln2nid on sn")
     self.assertEqual(m2.obj_sn2nid("CN"),
                      m2.obj_ln2nid("commonName"),
                      "ln2nid and sn2nid mismatch")
     self.assertEqual(m2.obj_sn2nid("CN"),
                      m2.obj_obj2nid(m2.obj_txt2obj("CN", 0)), "obj2nid")
     self.assertEqual(m2.obj_txt2nid("__unknown"),
                      0, "__unknown")
Example #4
0
 def test_obj2txt(self):
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1),
                      b"2.5.4.3", b"2.5.4.3")
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0),
                      b"commonName", b"commonName")
Example #5
0
 def test_obj2txt(self):
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0),
                           1) == "2.5.4.3", "2.5.4.3"
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0),
                           0) == "commonName", "commonName"
Example #6
0
 def test_nid(self):
     assert m2.obj_ln2nid("commonName") == m2.obj_txt2nid("2.5.4.3"), "ln2nid and txt2nid mismatch"
     assert m2.obj_ln2nid("CN") == 0, "ln2nid on sn"
     assert m2.obj_sn2nid("CN") == m2.obj_ln2nid("commonName"), "ln2nid and sn2nid mismatch"
     assert m2.obj_sn2nid("CN") == m2.obj_obj2nid(m2.obj_txt2obj("CN", 0)), "obj2nid"
     assert m2.obj_txt2nid("__unknown") == 0, "__unknown"
Example #7
0
 def test_obj2txt(self):
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1) == "2.5.4.3", "2.5.4.3"
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0) == "commonName", "commonName"
Example #8
0
 def test_obj2txt(self):
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1),
                      b"2.5.4.3", b"2.5.4.3")
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0),
                      b"commonName", b"commonName")