From 48c37eeff2ee8ae1a52740b62c0fdef80e529ef7 Mon Sep 17 00:00:00 2001 From: Victor Wagner Date: Mon, 29 Jun 2015 15:47:25 +0300 Subject: [PATCH] Fixed usage of named temporary file in tests, tests should run on Windows --- tests/testx509.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/testx509.py b/tests/testx509.py index d083b1c..fb6e054 100644 --- a/tests/testx509.py +++ b/tests/testx509.py @@ -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 -- 2.39.5