def test_get_new_command_mocked(cmdnf_mock, command, new_command, return_value): get_packages = Mock(return_value=return_value) cmdnf_mock.CommandNotFound.return_value = Mock(getPackages=get_packages) assert get_new_command(command, None) == new_command assert cmdnf_mock.CommandNotFound.called assert get_packages.called
def test_get_new_command(command, new_command): assert get_new_command(command, None) == new_command
def test_get_new_command(mocker, command, new_command, packages): mock = mocker.patch('thefuck.rules.apt_get.command_not_found', create=True) mock.getPackages.return_value = packages assert get_new_command(command) == new_command
def test_get_new_command(mocker, command, new_command, packages): mocker.patch("thefuck.rules.apt_get._get_packages", create=True, return_value=packages) assert get_new_command(command) == new_command