mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-28 16:12:36 +01:00
Create thefuck.archlinux
This commit is contained in:
@@ -7,6 +7,7 @@ from tests.utils import Command
|
||||
|
||||
pacman_cmd = getattr(pacman, 'pacman', 'pacman')
|
||||
|
||||
PKGFILE_OUTPUT_SUDO = 'core/sudo 1.8.13-13/usr/bin/sudo'
|
||||
PKGFILE_OUTPUT_CONVERT = 'extra/imagemagick 6.9.1.0-1\t/usr/bin/convert'
|
||||
|
||||
PKGFILE_OUTPUT_VIM = '''extra/gvim 7.4.712-1 \t/usr/bin/vim
|
||||
@@ -28,7 +29,7 @@ def test_match(command):
|
||||
@pytest.mark.parametrize('command, return_value', [
|
||||
(Command(script='vim', stderr='vim: command not found'), PKGFILE_OUTPUT_VIM),
|
||||
(Command(script='sudo vim', stderr='sudo: vim: command not found'), PKGFILE_OUTPUT_VIM)])
|
||||
@patch('thefuck.rules.pacman.subprocess')
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch.multiple(pacman, create=True, pacman=pacman_cmd)
|
||||
def test_match_mocked(subp_mock, command, return_value):
|
||||
subp_mock.check_output.return_value = return_value
|
||||
@@ -72,8 +73,9 @@ def test_get_new_command(command, new_command, mocker):
|
||||
(Command('vim'), vim_possibilities, PKGFILE_OUTPUT_VIM),
|
||||
(Command('sudo vim'), sudo_vim_possibilities, PKGFILE_OUTPUT_VIM),
|
||||
(Command('convert'), ['{} -S extra/imagemagick && convert'.format(pacman_cmd)], PKGFILE_OUTPUT_CONVERT),
|
||||
(Command('sudo'), ['{} -S core/sudo && sudo'.format(pacman_cmd)], PKGFILE_OUTPUT_SUDO),
|
||||
(Command('sudo convert'), ['{} -S extra/imagemagick && sudo convert'.format(pacman_cmd)], PKGFILE_OUTPUT_CONVERT)])
|
||||
@patch('thefuck.rules.pacman.subprocess')
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch.multiple(pacman, create=True, pacman=pacman_cmd)
|
||||
def test_get_new_command_mocked(subp_mock, command, new_command, return_value):
|
||||
subp_mock.check_output.return_value = return_value
|
||||
|
Reference in New Issue
Block a user