From 1d84595938f92455d08f702513a0d4ad0ce63b8c Mon Sep 17 00:00:00 2001 From: Alpamys Date: Wed, 1 Apr 2026 13:53:03 +0500 Subject: [PATCH] fix: correct mock parameter names and add assertion in deploy tests Fix reversed @patch decorator argument binding in 4 tests and add mock_deploy_fn.assert_called_once() in test_export_deploy_ollama_success. --- tests/test_deploy_ollama.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_deploy_ollama.py b/tests/test_deploy_ollama.py index 89a2164..580886e 100644 --- a/tests/test_deploy_ollama.py +++ b/tests/test_deploy_ollama.py @@ -594,7 +594,7 @@ def test_deploy_unknown_parameter_key(mock_detect, tmp_path, monkeypatch): @patch(f"{_OLLAMA}.deploy_to_ollama", return_value=(True, "created")) @patch(f"{_OLLAMA}.detect_ollama", return_value="0.6.2") -def test_deploy_full_success(mock_detect, mock_deploy, tmp_path, monkeypatch): +def test_deploy_full_success(mock_detect_fn, mock_deploy_fn, tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) gguf = tmp_path / "model.gguf" gguf.write_bytes(b"fake gguf data") @@ -617,7 +617,7 @@ def test_deploy_full_success(mock_detect, mock_deploy, tmp_path, monkeypatch): @patch(f"{_OLLAMA}.deploy_to_ollama", return_value=(False, "disk full")) @patch(f"{_OLLAMA}.detect_ollama", return_value="0.6.2") -def test_deploy_create_fails(mock_detect, mock_deploy, tmp_path, monkeypatch): +def test_deploy_create_fails(mock_detect_fn, mock_deploy_fn, tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) gguf = tmp_path / "model.gguf" gguf.write_bytes(b"fake gguf data") @@ -710,17 +710,17 @@ def test_export_deploy_ollama_not_found(mock_detect): @patch(f"{_OLLAMA}.deploy_to_ollama", return_value=(True, "ok")) @patch(f"{_OLLAMA}.detect_ollama", return_value="0.6.2") -def test_export_deploy_ollama_success(mock_detect, mock_deploy): +def test_export_deploy_ollama_success(mock_detect_fn, mock_deploy_fn): """_auto_deploy_ollama succeeds with valid inputs.""" from soup_cli.commands.export import _auto_deploy_ollama - # Should not raise _auto_deploy_ollama(Path("model.gguf"), "mymodel", "ollama", "soup-mymodel") + mock_deploy_fn.assert_called_once() @patch(f"{_OLLAMA}.deploy_to_ollama", return_value=(False, "fail")) @patch(f"{_OLLAMA}.detect_ollama", return_value="0.6.2") -def test_export_deploy_ollama_create_fails(mock_detect, mock_deploy): +def test_export_deploy_ollama_create_fails(mock_detect_fn, mock_deploy_fn): """_auto_deploy_ollama exits on deploy failure.""" from soup_cli.commands.export import _auto_deploy_ollama