1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-19 11:42:33 +01:00

Add transparent sudo support for rules where it required

This commit is contained in:
nvbn
2015-04-22 16:45:38 +02:00
parent 7010b3a7f6
commit e7b78205f4
11 changed files with 68 additions and 1 deletions

17
tests/test_utils.py Normal file
View File

@@ -0,0 +1,17 @@
from mock import Mock
from thefuck.utils import sudo_support
from thefuck.main import Command
def test_sudo_support():
fn = Mock(return_value=True, __name__='')
assert sudo_support(fn)(Command('sudo ls', 'out', 'err'), None)
fn.assert_called_once_with(Command('ls', 'out', 'err'), None)
fn.return_value = False
assert not sudo_support(fn)(Command('sudo ls', 'out', 'err'), None)
fn.return_value = 'pwd'
assert sudo_support(fn)(Command('sudo ls', 'out', 'err'), None) == 'sudo pwd'
assert sudo_support(fn)(Command('ls', 'out', 'err'), None) == 'pwd'