Ejemplo n.º 1
0
 def test_temp_cert_raise(self):
     fn = None
     try:
         with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
             raise ValueError()
         self.fail()
     except ValueError:
         self.assertFalse(os.path.exists(ca_filename))
Ejemplo n.º 2
0
 def test_temp_cert_success(self):
     fn = None
     with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
         self.assertTrue(os.path.exists(ca_filename))
         with open(ca_filename) as f:
             lines = f.readlines()
             self.assertIn("-----BEGIN CERTIFICATE-----\n", lines)
     self.assertFalse(os.path.exists(ca_filename))
Ejemplo n.º 3
0
 def test_temp_cert_success(self):
     fn = None
     with temp_cert(PIN_GOOGLE_CA_CERT) as ca_file:
         fn = ca_file.name
         self.assertTrue(os.path.exists(fn))
         lines = ca_file.readlines()
         self.assertIn("-----BEGIN CERTIFICATE-----\n", lines)
     self.assertFalse(os.path.exists(fn))