1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 10:51:11 +01:00
thefuck/tests/rules/test_sudo.py

25 lines
742 B
Python
Raw Normal View History

import pytest
2015-04-08 17:15:49 +01:00
from thefuck.rules.sudo import match, get_new_command
from tests.utils import Command
2015-04-08 17:15:49 +01:00
@pytest.mark.parametrize('stderr, stdout', [
('Permission denied', ''),
('permission denied', ''),
("npm ERR! Error: EACCES, unlink", ''),
('requested operation requires superuser privilege', ''),
2015-06-16 01:08:08 +01:00
('need to be root', ''),
('need root', ''),
('must be root', ''),
('', "error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ipaddr.py'")])
def test_match(stderr, stdout):
assert match(Command(stderr=stderr, stdout=stdout), None)
def test_not_match():
assert not match(Command(), None)
2015-04-08 17:15:49 +01:00
def test_get_new_command():
assert get_new_command(Command('ls'), None) == 'sudo ls'