2015-08-20 00:23:33 +02:00
|
|
|
import pytest
|
|
|
|
from thefuck.rules.apt_get_search import get_new_command, match
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2015-08-20 00:23:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2017-08-31 17:58:56 +02:00
|
|
|
assert match(Command('apt-get search foo', ''))
|
2015-08-20 00:23:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
Command('apt-cache search foo', ''),
|
|
|
|
Command('aptitude search foo', ''),
|
|
|
|
Command('apt search foo', ''),
|
|
|
|
Command('apt-get install foo', ''),
|
|
|
|
Command('apt-get source foo', ''),
|
|
|
|
Command('apt-get clean', ''),
|
|
|
|
Command('apt-get remove', ''),
|
|
|
|
Command('apt-get update', '')
|
2015-08-20 00:23:33 +02:00
|
|
|
])
|
|
|
|
def test_not_match(command):
|
2015-09-07 13:00:29 +03:00
|
|
|
assert not match(command)
|
2015-08-20 00:23:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2017-08-31 17:58:56 +02:00
|
|
|
new_command = get_new_command(Command('apt-get search foo', ''))
|
|
|
|
assert new_command == 'apt-cache search foo'
|