Skip to content

Commit ca0966f

Browse files
committed
Update tests to not check selector field
1 parent 5b3ae0c commit ca0966f

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

tests/unit/dbt_cli/test_cli_integration.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ def decorator(func):
103103
# Verify the command was called correctly
104104
mock_popen.assert_called_once()
105105
actual_args = mock_popen.call_args.kwargs.get("args")
106-
self.assertEqual(actual_args, expected_args)
106+
107+
has_quiet = False if command_name == "ls" else True
108+
num_params = 3 if has_quiet else 2
109+
110+
self.assertEqual(actual_args[:num_params], expected_args[:num_params])
111+
self.assertEqual(actual_args[-2:], ["--log-format", "json"])
107112

108113
# Verify correct working directory
109114
self.assertEqual(mock_popen.call_args.kwargs.get("cwd"), "/test/project")

tests/unit/dbt_cli/test_tools.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@ def decorator(func):
6363
# Check if the --quiet flag was added
6464
args_list = mock_popen.call_args.kwargs.get("args")
6565
self.assertEqual(
66-
args_list,
67-
["/path/to/dbt", command, "--quiet", "--log-format", "json"],
66+
args_list[:3],
67+
["/path/to/dbt", command, "--quiet"],
68+
)
69+
# check that the log format is last
70+
self.assertEqual(
71+
args_list[-2:],
72+
["--log-format", "json"],
6873
)
6974

7075
@patch("subprocess.Popen")
@@ -102,7 +107,8 @@ def decorator(func):
102107

103108
# Check that --quiet flag was NOT added
104109
args_list = mock_popen.call_args.kwargs.get("args")
105-
self.assertEqual(args_list, ["/path/to/dbt", "list", "--log-format", "json"])
110+
self.assertEqual(args_list[:2], ["/path/to/dbt", "list"])
111+
self.assertEqual(args_list[-2:], ["--log-format", "json"])
106112

107113
@patch("subprocess.Popen")
108114
def test_show_command_correctly_formatted(self, mock_popen):

0 commit comments

Comments
 (0)