mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-10 22:03:58 +01:00
Move all app/os specific utils to specific
package
This commit is contained in:
18
tests/specific/test_sudo.py
Normal file
18
tests/specific/test_sudo.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
from mock import Mock
|
||||
from thefuck.specific.sudo import sudo_support
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('return_value, command, called, result', [
|
||||
('ls -lah', 'sudo ls', 'ls', 'sudo ls -lah'),
|
||||
('ls -lah', 'ls', 'ls', 'ls -lah'),
|
||||
(['ls -lah'], 'sudo ls', 'ls', ['sudo ls -lah']),
|
||||
(True, 'sudo ls', 'ls', True),
|
||||
(True, 'ls', 'ls', True),
|
||||
(False, 'sudo ls', 'ls', False),
|
||||
(False, 'ls', 'ls', False)])
|
||||
def test_sudo_support(return_value, command, called, result):
|
||||
fn = Mock(return_value=return_value, __name__='')
|
||||
assert sudo_support(fn)(Command(command), None) == result
|
||||
fn.assert_called_once_with(Command(called), None)
|
Reference in New Issue
Block a user