From 6763a6558413fcc73694c8d33f332b366dcc40f6 Mon Sep 17 00:00:00 2001 From: Nicholas Yager Date: Fri, 22 Mar 2024 20:54:09 -0400 Subject: [PATCH] feat: Add tests to confirm functionality --- tests/integration/test_cli_group.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/integration/test_cli_group.py diff --git a/tests/integration/test_cli_group.py b/tests/integration/test_cli_group.py new file mode 100644 index 0000000..cae893b --- /dev/null +++ b/tests/integration/test_cli_group.py @@ -0,0 +1,31 @@ +from click.testing import CliRunner + +from dbt_meshify.cli import get_version +from dbt_meshify.main import cli + + +def test_version_option(): + """When the --version option is passed, meshify returns the version and exits.""" + + runner = CliRunner() + result = runner.invoke( + cli, + [ + "--version", + ], + ) + + assert result.exit_code == 0 + assert result.stdout.rstrip() == get_version() + + +def test_no_command_prints_help(): + """When an invoked subcommand is not provided, print the help and exit.""" + + runner = CliRunner() + result = runner.invoke(cli) + + assert result.exit_code == 0 + + help_result = result = runner.invoke(cli, ["--help"]) + assert result.stdout == help_result.stdout