mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
6d39b78824
$ dnf history You don't have access to the history DB.
26 lines
797 B
Python
26 lines
797 B
Python
import pytest
|
|
from thefuck.rules.sudo import match, get_new_command
|
|
from tests.utils import Command
|
|
|
|
|
|
@pytest.mark.parametrize('stderr, stdout', [
|
|
('Permission denied', ''),
|
|
('permission denied', ''),
|
|
("npm ERR! Error: EACCES, unlink", ''),
|
|
('requested operation requires superuser privilege', ''),
|
|
('need to be root', ''),
|
|
('need root', ''),
|
|
('must be root', ''),
|
|
('You don\'t have access to the history DB.', ''),
|
|
('', "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)
|
|
|
|
|
|
def test_get_new_command():
|
|
assert get_new_command(Command('ls'), None) == 'sudo ls'
|