diff --git a/functional_tests/test_server.py b/functional_tests/test_server.py index 095fc57bba6436a1f58f2b1a52d5a19a5580012c..fdc91ec81c1b87539078b0cf420ac2953d48b39e 100644 --- a/functional_tests/test_server.py +++ b/functional_tests/test_server.py @@ -43,3 +43,19 @@ def test_server_command_available_with_help(): assert stderr == "" assert stdout.startswith("usage: gimmecert server") assert stdout.split('\n')[0].endswith(" entity_name [dns_name [dns_name ...]]") # First line of help. + + +def test_server_command_requires_initialised_hierarchy(tmpdir): + # John is about to issue a server certificate. He switches to his + # project directory. + tmpdir.chdir() + + # John tries to issue a server certificate. + stdout, stderr, exit_code = run_command("gimmecert", "server", "myserver") + + # Unfortunately, John has forgotten to initialise the CA hierarchy + # from within this directory, and is instead presented with an + # error. + assert stdout == "" + assert stderr == "CA hierarchy must be initialised prior to issuing server certificates. Run the gimmecert init command first.\n" + assert exit_code != 0