Skip to content

Commit 675534c

Browse files
alexreaperhulk
authored andcommitted
Make tests pass in the future (now the present) (#888)
1 parent 1ede584 commit 675534c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_ssl.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def _create_certificate_chain():
192192
3. A new server certificate signed by icert (scert)
193193
"""
194194
caext = X509Extension(b'basicConstraints', False, b'CA:true')
195+
not_after_date = (datetime.date.today() + datetime.timedelta(days=365))
196+
not_after = not_after_date.strftime("%Y%m%d%H%M%SZ").encode("ascii")
195197

196198
# Step 1
197199
cakey = PKey()
@@ -201,7 +203,7 @@ def _create_certificate_chain():
201203
cacert.set_issuer(cacert.get_subject())
202204
cacert.set_pubkey(cakey)
203205
cacert.set_notBefore(b"20000101000000Z")
204-
cacert.set_notAfter(b"20200101000000Z")
206+
cacert.set_notAfter(not_after)
205207
cacert.add_extensions([caext])
206208
cacert.set_serial_number(0)
207209
cacert.sign(cakey, "sha1")
@@ -214,7 +216,7 @@ def _create_certificate_chain():
214216
icert.set_issuer(cacert.get_subject())
215217
icert.set_pubkey(ikey)
216218
icert.set_notBefore(b"20000101000000Z")
217-
icert.set_notAfter(b"20200101000000Z")
219+
icert.set_notAfter(not_after)
218220
icert.add_extensions([caext])
219221
icert.set_serial_number(0)
220222
icert.sign(cakey, "sha1")
@@ -227,7 +229,7 @@ def _create_certificate_chain():
227229
scert.set_issuer(icert.get_subject())
228230
scert.set_pubkey(skey)
229231
scert.set_notBefore(b"20000101000000Z")
230-
scert.set_notAfter(b"20200101000000Z")
232+
scert.set_notAfter(not_after)
231233
scert.add_extensions([
232234
X509Extension(b'basicConstraints', True, b'CA:false')])
233235
scert.set_serial_number(0)

0 commit comments

Comments
 (0)