Changeset - 1d2be8bb324d
[Not reviewed]
0 3 0
Branko Majic (branko) - 6 years ago 2018-03-21 21:21:17
branko@majic.rs
GC-19: Updated server --update-dns-names implementation to inform user about unchanged private key:

- Updated functional and unit tests.
- Updated message shown to user when using --update-dns-names server
option to include information about private key remaining the same.
3 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
functional_tests/test_server.py
Show inline comments
 
@@ -243,9 +243,10 @@ def test_server_command_update_option(tmpdir):
 

	
 
    # He notices that no error has been reported by the command, and
 
    # that he is informed that the certificate has been renewed with
 
    # new DNS names.
 
    # new DNS names, while the private key has been preserved.
 
    assert exit_code == 0
 
    assert "renewed with new DNS subject alternative names" in stdout
 
    assert "key has remained unchanged" in stdout
 

	
 
    # Being paranoid, he decides to double-check the certificate, just
 
    # to be on the safe side. He uses the OpenSSL CLI for this
gimmecert/commands.py
Show inline comments
 
@@ -150,6 +150,7 @@ def server(stdout, stderr, project_directory, entity_name, extra_dns_names, upda
 

	
 
    if renew_certificate_only:
 
        print("""Server certificate renewed with new DNS subject alternative names.\n
 
        Server private key has remained unchanged.\n
 
        Server private key: .gimmecert/server/%s.key.pem
 
        Server certificate: .gimmecert/server/%s.cert.pem""" % (entity_name, entity_name), file=stdout)
 
    else:
tests/test_commands.py
Show inline comments
 
@@ -439,6 +439,7 @@ def test_server_reports_success_if_certificate_already_issued_but_update_was_req
 
    assert ".gimmecert/server/myserver.key.pem" in stdout
 
    assert ".gimmecert/server/myserver.cert.pem" in stdout
 
    assert "renewed with new DNS subject alternative names" in stdout
 
    assert "key has remained unchanged" in stdout
 
    assert stderr == ""
 
    assert tmpdir.join('.gimmecert', 'server', 'myserver.key.pem').read() == existing_private_key
 
    assert tmpdir.join('.gimmecert', 'server', 'myserver.cert.pem').read() != certificate
0 comments (0 inline, 0 general)