Commit 316d365a by Jérome Perrin

test: assert certificate is created after 36500 days, not 100 years

As we can see today:

AssertionError: ' 2119 ' not found in 'notAfter=Dec 14 00:54:31 2118 GMT\n')
1 parent c08f207e
......@@ -657,13 +657,14 @@ 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], universal_newlines=True)
self.assertEqual('subject=CN = %s' % self.common_name, result.strip())
result = subprocess.check_output(['openssl', 'x509', '-noout', '-enddate',
'-in', self.certificate], universal_newlines=True)
self.assertIn(' %s ' % (today.year + 100), result)
expiration_date = datetime.date.today() + datetime.timedelta(days=36500)
self.assertIn(' %s ' % expiration_date.year, result)
def test_generate_key_exists(self):
with tempfile.NamedTemporaryFile() as key:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!