2015-04-25 02:54:39 +02:00
|
|
|
import pytest
|
2015-04-08 18:15:49 +02:00
|
|
|
from thefuck.rules.sudo import match, get_new_command
|
2015-04-25 02:35:26 +02:00
|
|
|
from tests.utils import Command
|
2015-04-08 18:15:49 +02:00
|
|
|
|
|
|
|
|
2015-04-25 02:54:39 +02:00
|
|
|
@pytest.mark.parametrize('stderr', ['Permission denied',
|
|
|
|
'permission denied',
|
|
|
|
"npm ERR! Error: EACCES, unlink"])
|
|
|
|
def test_match(stderr):
|
|
|
|
assert match(Command(stderr=stderr), None)
|
|
|
|
|
|
|
|
|
|
|
|
def test_not_match():
|
2015-04-25 02:35:26 +02:00
|
|
|
assert not match(Command(), None)
|
2015-04-08 18:15:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2015-04-25 02:35:26 +02:00
|
|
|
assert get_new_command(Command('ls'), None) == 'sudo ls'
|