2015-04-25 02:54:39 +02:00
|
|
|
import pytest
|
2015-04-22 16:22:10 +02:00
|
|
|
from thefuck.rules.rm_root import match, get_new_command
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2015-04-22 16:22:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2019-10-25 00:51:47 +03:00
|
|
|
assert match(Command('rm -rf /', ''))
|
2015-04-25 02:54:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
Command('ls', 'add --no-preserve-root'),
|
2019-10-25 00:51:47 +03:00
|
|
|
Command('rm', '/usr/bin/python')])
|
2015-04-25 02:54:39 +02:00
|
|
|
def test_not_match(command):
|
2015-09-07 13:00:29 +03:00
|
|
|
assert not match(command)
|
2015-04-22 16:22:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2019-10-25 00:51:47 +03:00
|
|
|
assert 'rm' not in (get_new_command(Command('rm -rf /', '')))
|