Esempio n. 1
0
    def test_003_x500name_from_string(self):
        """Creates an X500Name from a serialised string."""
        x500name = X500Name.from_string(standard_string1)
        self.compare_against_standard(x500name, True, True, True)

        x500name = X500Name.from_string(standard_string2)
        self.compare_against_standard(x500name, True, True, True)

        x500name = X500Name.from_string(standard_string3)
        self.compare_against_standard(x500name, True, False, False)

        x500name = X500Name.from_string(standard_string4)
        self.compare_against_standard(x500name, False, False, False)
Esempio n. 2
0
 def test_005_x500name_from_string_fail_validate(self):
     """Value in serialised string does not meet the requirements."""
     with self.assertRaises(ValueError) as e:
         X500Name.from_string(standard_string6)
     self.assertIn('Wrong length: ', str(e.exception))
Esempio n. 3
0
 def test_004_x500name_from_string_missing_val(self):
     """Required values missing from serialised string."""
     with self.assertRaises(TypeError) as e:
         X500Name.from_string(standard_string5)
     self.assertIn('Missing: country', str(e.exception))
Esempio n. 4
0
 def test_017_x500name_as_dict(self):
     """Gets the X500Name as a dictionary."""
     x500name = X500Name.from_string(standard_string1)
     self.compare_dict_against_standard(x500name.as_dict())