diff --git a/tests/test_cli.py b/tests/test_cli.py index 70911e4c0fefef7a5a13851117ff2ae037b4710f..485c5d2042d4fe77049c1a6966da1b4eb127fd0c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -163,21 +163,25 @@ def test_setup_init_subcommand_sets_function_callback(): @mock.patch('sys.argv', ['gimmecert', 'init']) @mock.patch('gimmecert.cli.init') def test_init_command_invoked_with_correct_parameters_no_options(mock_init, tmpdir): + default_depth = 1 + tmpdir.chdir() gimmecert.cli.main() - mock_init.assert_called_once_with(tmpdir.strpath, tmpdir.basename) + mock_init.assert_called_once_with(tmpdir.strpath, tmpdir.basename, default_depth) @mock.patch('sys.argv', ['gimmecert', 'init', '-b', 'My Project']) @mock.patch('gimmecert.cli.init') def test_init_command_invoked_with_correct_parameters_with_options(mock_init, tmpdir): + default_depth = 1 + tmpdir.chdir() gimmecert.cli.main() - mock_init.assert_called_once_with(tmpdir.strpath, 'My Project') + mock_init.assert_called_once_with(tmpdir.strpath, 'My Project', default_depth) @mock.patch('sys.argv', ['gimmecert', 'init', '--ca-base-name', 'My Project']) @@ -190,3 +194,15 @@ def test_init_command_accepts_ca_base_name_option_long_form(): def test_init_command_accepts_ca_base_name_option_short_form(): gimmecert.cli.main() # Should not raise + + +@mock.patch('sys.argv', ['gimmecert', 'init', '--ca-hierarchy-depth', '3']) +def test_init_command_accepts_ca_hierarchy_depth_option_long_form(): + + gimmecert.cli.main() # Should not raise + + +@mock.patch('sys.argv', ['gimmecert', 'init', '-d', '3']) +def test_init_command_accepts_ca_hierarchy_depth_option_short_form(): + + gimmecert.cli.main() # Should not raise