Skip to content

Commit 389460b

Browse files
committed
Add unit test
1 parent 98c040c commit 389460b

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/unit/dbt_cli/test_tools.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,26 @@ def mock_popen(*args, **kwargs):
241241
result = list_tool(selector="my_model", resource_type=["model"])
242242
assert "Timeout: dbt command took too long to complete" in result
243243
assert "Try using a specific selector to narrow down the results" in result
244+
245+
246+
@pytest.mark.parametrize("command_name", ["run", "build"])
247+
def test_full_refresh_flag_added_to_command(
248+
monkeypatch: MonkeyPatch, mock_process, mock_fastmcp, command_name
249+
):
250+
mock_calls = []
251+
252+
def mock_popen(args, **kwargs):
253+
mock_calls.append(args)
254+
return mock_process
255+
256+
monkeypatch.setattr("subprocess.Popen", mock_popen)
257+
258+
fastmcp, tools = mock_fastmcp
259+
register_dbt_cli_tools(fastmcp, mock_dbt_cli_config)
260+
tool = tools[command_name]
261+
262+
tool(is_full_refresh=True)
263+
264+
assert mock_calls
265+
args_list = mock_calls[0]
266+
assert "--full-refresh" in args_list

0 commit comments

Comments
 (0)