2015-04-25 01:54:39 +01:00
|
|
|
import pytest
|
2015-04-22 15:22:10 +01:00
|
|
|
from thefuck.rules.rm_root import match, get_new_command
|
2017-08-31 16:58:56 +01:00
|
|
|
from thefuck.types import Command
|
2015-04-22 15:22:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2017-08-31 16:58:56 +01:00
|
|
|
assert match(Command('rm -rf /', 'add --no-preserve-root'))
|
2015-04-25 01:54:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 16:58:56 +01:00
|
|
|
Command('ls', 'add --no-preserve-root'),
|
|
|
|
Command('rm --no-preserve-root /', 'add --no-preserve-root'),
|
|
|
|
Command('rm -rf /', '')])
|
2015-04-25 01:54:39 +01:00
|
|
|
def test_not_match(command):
|
2015-09-07 11:00:29 +01:00
|
|
|
assert not match(command)
|
2015-04-22 15:22:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2017-08-31 16:58:56 +01:00
|
|
|
assert (get_new_command(Command('rm -rf /', ''))
|
2016-10-06 19:51:22 +01:00
|
|
|
== 'rm -rf / --no-preserve-root')
|