def test_not_match(mocker, command, packages, which): mocker.patch("thefuck.rules.apt_get.which", return_value=which) mocker.patch("thefuck.rules.apt_get._get_packages", create=True, return_value=packages) assert not match(command)
def test_not_match(mocker, command, packages, which): mocker.patch('thefuck.rules.apt_get.which', return_value=which) mock = mocker.patch('thefuck.rules.apt_get.command_not_found', create=True) mock.getPackages.return_value = packages assert not match(command)
def test_match(mocker, command, packages): mocker.patch('thefuck.rules.apt_get.which', return_value=None) mocker.patch('thefuck.rules.apt_get._get_packages', create=True, return_value=packages) assert match(command)
def test_not_match(command): assert not match(command, None)
def test_match_mocked(cmdnf_mock, command, return_value): get_packages = Mock(return_value=return_value) cmdnf_mock.CommandNotFound.return_value = Mock(getPackages=get_packages) assert match(command, None) assert cmdnf_mock.CommandNotFound.called assert get_packages.called
def test_match(command): assert match(command)
def test_not_match_mocked(cmdnf_mock, command, return_value): get_packages = Mock(return_value=return_value) cmdnf_mock.CommandNotFound.return_value = Mock(getPackages=get_packages) assert not match(command)