Changeset - 52778a401e6e
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-05-13 14:54:05
branko@majic.rs
GC-35: Freeze time when testing status command outputs:

Freezing the time will ensure the tests can be run in future without
having to make modifications for issuance dates - otherwise the tests
will fail because certificates will be reported as expired.
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
tests/test_commands.py
Show inline comments
 
@@ -698,7 +698,8 @@ def test_status_reports_ca_hierarchy_information(tmpdir):
 
    with freeze_time('2018-01-01 00:15:00'):
 
        gimmecert.commands.init(io.StringIO(), io.StringIO(), tmpdir.strpath, tmpdir.basename, depth)
 

	
 
    status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 
    with freeze_time('2018-06-01 00:15:00'):
 
        status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 

	
 
    stdout = stdout_stream.getvalue()
 
    stdout_lines = stdout.split("\n")
 
@@ -757,7 +758,8 @@ def test_status_reports_server_certificate_information(tmpdir):
 
    with freeze_time('2018-04-01 00:15:00'):
 
        gimmecert.commands.server(io.StringIO(), io.StringIO(), tmpdir.strpath, 'myserver3', None, myserver3_csr_file.strpath)
 

	
 
    status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 
    with freeze_time('2018-06-01 00:15:00'):
 
        status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 

	
 
    stdout = stdout_stream.getvalue()
 
    stdout_lines = stdout.split("\n")
 
@@ -826,7 +828,8 @@ def test_status_reports_client_certificate_information(tmpdir):
 
    with freeze_time('2018-04-01 00:15:00'):
 
        gimmecert.commands.client(io.StringIO(), io.StringIO(), tmpdir.strpath, 'myclient3', myclient3_csr_file.strpath)
 

	
 
    status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 
    with freeze_time('2018-06-01 00:15:00'):
 
        status_code = gimmecert.commands.status(stdout_stream, stderr_stream, tmpdir.strpath)
 

	
 
    stdout = stdout_stream.getvalue()
 
    stdout_lines = stdout.split("\n")
0 comments (0 inline, 0 general)