]> wagner.pp.ru Git - oss/ctypescrypto.git/commitdiff
Fixed usage of named temporary file in tests, tests should run on Windows
authorVictor Wagner <wagner@atlas-card.ru>
Mon, 29 Jun 2015 12:47:25 +0000 (15:47 +0300)
committerVictor Wagner <wagner@atlas-card.ru>
Mon, 29 Jun 2015 12:47:25 +0000 (15:47 +0300)
tests/testx509.py

index d083b1c59f75f2f8c69b75447e5cd6b96f77de40..fb6e054231e10170c00925b40d8978e068889f06 100644 (file)
@@ -6,6 +6,7 @@ from ctypescrypto.oid import Oid
 from tempfile import NamedTemporaryFile
 import datetime
 import unittest
+import os
 
 
 
@@ -244,13 +245,14 @@ zVMSW4SOwg/H7ZMZ2cn6j1g0djIvruFQFGHUqFijyDATI+/GJYw2jxyA
         c2=X509(self.digicert_cert)
         self.assertTrue(c2.verify(store))
     def test_verify_by_filestore(self):
-        trusted=NamedTemporaryFile()
+        trusted=NamedTemporaryFile(delete=False)
         trusted.write(self.ca_cert)
-        trusted.flush()
+        trusted.close()
         goodcert=X509(self.cert1)
         badcert=X509(self.cert1[0:-30]+"GG"+self.cert1[-28:])
         gitcert=X509(self.digicert_cert)
         store=X509Store(file=trusted.name)
+        os.unlink(trusted.name)
         # We should successfuly verify certificate signed by our CA cert
         self.assertTrue(goodcert.verify(store))
         # We should reject corrupted certificate