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():
|
2017-08-31 17:58:56 +02:00
|
|
|
assert match(Command('rm -rf /', 'add --no-preserve-root'))
|
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'),
|
|
|
|
Command('rm --no-preserve-root /', 'add --no-preserve-root'),
|
|
|
|
Command('rm -rf /', '')])
|
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():
|
2017-08-31 17:58:56 +02:00
|
|
|
assert (get_new_command(Command('rm -rf /', ''))
|
2016-10-06 14:51:22 -04:00
|
|
|
== 'rm -rf / --no-preserve-root')
|