def test_common_name(self):
     _cert = Certificate(pfx_file=pfx_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.common_name()), "myRSAdemoserver")
 def test_serial_number(self):
     _cert = Certificate(pfx_file=pfx_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.serial_number()),
                      "128805826665071774012132547883470073087342988157")
 def test_issuer(self):
     _cert = Certificate(pfx_file=pfx_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.issuer()), "<Name(CN=myRSAdemoserver)>")
 def test_not_valid_after(self):
     _cert = Certificate(pfx_file=pfx_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.not_valid_after()), "2024-10-20 15:20:15")
 def test_not_valid_before(self):
     _cert = Certificate(pfx_file=pfx_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.not_valid_before()), "2022-01-25 15:20:15")
    def test_pfx_senha_invalida(self):
        _cert = Certificate(pfx_file=pfx_file, password=password_fail)

        with self.assertRaises(Exception):
            _cert.read_pfx_file()
    def test_pfx_file_not_found(self):
        _cert = Certificate(pfx_file=pfx_file_not_found, password=password_ok)

        with self.assertRaises(FileNotFoundError):
            _cert.read_pfx_file()
 def test_p12_subject(self):
     _cert = Certificate(pfx_file=p12_file, password=password_ok)
     _cert.read_pfx_file()
     self.assertEqual(str(_cert.subject()), "<Name(CN=myRSAdemoserver)>")