diff --git a/tests/test_cli.py b/tests/test_cli.py index c10dc783060cbf0bcf7790f3b55138f80599be64..c67bce3a7d87db2739f057addd0a622f71ad2e2c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -20,7 +20,6 @@ import argparse -import os import gimmecert.cli import gimmecert.decorators @@ -162,22 +161,10 @@ def test_setup_init_subcommand_sets_function_callback(): @mock.patch('sys.argv', ['gimmecert', 'init']) -def test_init_subcommand_generates_ca_private_key(tmpdir): +@mock.patch('gimmecert.cli.init') +def test_init_command_invoked_with_correct_parameters(mock_init, tmpdir): tmpdir.chdir() gimmecert.cli.main() - print(tmpdir.listdir()) - - assert os.path.exists(tmpdir.join('.gimmecert', 'ca', 'level1.key.pem').strpath) - - -@mock.patch('sys.argv', ['gimmecert', 'init']) -def test_init_subcommand_generates_ca_certificate(tmpdir): - tmpdir.chdir() - - gimmecert.cli.main() - - print(tmpdir.listdir()) - - assert os.path.exists(tmpdir.join('.gimmecert', 'ca', 'level1.cert.pem').strpath) + mock_init.assert_called_once_with(tmpdir.strpath)