Commit 35a73567 authored by Julien Muchembled's avatar Julien Muchembled

Fix test_generate_certificate

parent d423a1c4
import BaseHTTPServer
import datetime
import errno
import hashlib
import httplib
......@@ -924,12 +925,13 @@ class GenerateSignatureScriptTest(unittest.TestCase):
def test_generate_certificate(self):
slapos.signature.generateCertificate(self.certificate, self.key,
self.common_name)
today = datetime.date.today()
result = subprocess.check_output(['openssl', 'x509', '-noout', '-subject',
'-in', self.certificate])
self.assertEqual('subject= /CN=%s' % self.common_name, result.strip())
result = subprocess.check_output(['openssl', 'x509', '-noout', '-enddate',
'-in', self.certificate])
self.assertTrue('2112' in result)
self.assertTrue(' %s ' % (today.year + 100) in result)
def test_generate_key_exists(self):
self.assertRaises(ValueError, slapos.signature.generateCertificate,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment