@@ -171,57 +171,59 @@ def test_cli_version_check_disabled_by_config_success(mock_fab_set_state_config)
171171
172172@patch ("fabric_cli.utils.fab_version_check._fetch_latest_version_from_pypi" )
173173def test_cli_version_check_new_version_available_success (
174- mock_fetch , mock_fab_set_state_config
174+ mock_fetch , mock_fab_set_state_config , mock_questionary_print
175175):
176176 """Should display notification when newer version is available."""
177177 newer_version = _increment_version ("major" )
178178 mock_fab_set_state_config (fab_constant .FAB_CHECK_UPDATES , "true" )
179179 mock_fetch .return_value = newer_version
180180
181- with patch ("fabric_cli.utils.fab_version_check.fab_ui" ) as mock_ui :
182- fab_version_check .check_and_notify_update ()
181+ fab_version_check .check_and_notify_update ()
183182
184- # Should display notification
185- mock_ui . print_grey .assert_called ()
186- call_msg = str (mock_ui . print_grey .call_args )
187- assert newer_version in call_msg
188- assert "pip install --upgrade" in call_msg
183+ # Should display notification
184+ mock_questionary_print .assert_called ()
185+ call_msg = str (mock_questionary_print .call_args )
186+ assert newer_version in call_msg
187+ assert "pip install --upgrade" in call_msg
189188
190189
191190@patch ("fabric_cli.utils.fab_version_check._fetch_latest_version_from_pypi" )
192- def test_cli_version_check_same_version_success (mock_fetch , mock_fab_set_state_config ):
191+ def test_cli_version_check_same_version_success (
192+ mock_fetch , mock_fab_set_state_config , mock_questionary_print
193+ ):
193194 """Should not display notification when on latest version."""
194195 mock_fab_set_state_config (fab_constant .FAB_CHECK_UPDATES , "true" )
195196 mock_fetch .return_value = __version__
196197
197- with patch ("fabric_cli.utils.fab_version_check.fab_ui" ) as mock_ui :
198- fab_version_check .check_and_notify_update ()
198+ fab_version_check .check_and_notify_update ()
199199
200- # Should not display notification
201- mock_ui . print_grey .assert_not_called ()
200+ # Should not display notification
201+ mock_questionary_print .assert_not_called ()
202202
203203
204204@patch ("fabric_cli.utils.fab_version_check._fetch_latest_version_from_pypi" )
205- def test_cli_version_check_fetch_failure (mock_fetch , mock_fab_set_state_config ):
205+ def test_cli_version_check_fetch_failure (
206+ mock_fetch , mock_fab_set_state_config , mock_questionary_print
207+ ):
206208 """Should not display notification when PyPI fetch fails."""
207209 mock_fab_set_state_config (fab_constant .FAB_CHECK_UPDATES , "true" )
208210 mock_fetch .return_value = None # Simulate fetch failure
209211
210- with patch ("fabric_cli.utils.fab_version_check.fab_ui" ) as mock_ui :
211- fab_version_check .check_and_notify_update ()
212+ fab_version_check .check_and_notify_update ()
212213
213- # Should not display notification
214- mock_ui . print_grey .assert_not_called ()
214+ # Should not display notification
215+ mock_questionary_print .assert_not_called ()
215216
216217
217218@patch ("fabric_cli.utils.fab_version_check._fetch_latest_version_from_pypi" )
218- def test_cli_version_check_older_version_success (mock_fetch , mock_fab_set_state_config ):
219+ def test_cli_version_check_older_version_success (
220+ mock_fetch , mock_fab_set_state_config , mock_questionary_print
221+ ):
219222 """Should not display notification when PyPI version is older."""
220223 mock_fab_set_state_config (fab_constant .FAB_CHECK_UPDATES , "true" )
221224 mock_fetch .return_value = _decrement_version ()
222225
223- with patch ("fabric_cli.utils.fab_version_check.fab_ui" ) as mock_ui :
224- fab_version_check .check_and_notify_update ()
226+ fab_version_check .check_and_notify_update ()
225227
226- # Should not display notification
227- mock_ui . print_grey .assert_not_called ()
228+ # Should not display notification
229+ mock_questionary_print .assert_not_called ()
0 commit comments