1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_no_command.py
2015-04-21 06:55:47 +02:00

20 lines
741 B
Python

from mock import patch, Mock
from thefuck.rules.no_command import match, get_new_command
def test_match():
with patch('thefuck.rules.no_command._get_all_bins',
return_value=['vim', 'apt-get']):
assert match(Mock(stderr='vom: not found', script='vom file.py'), None)
assert not match(Mock(stderr='qweqwe: not found', script='qweqwe'), None)
assert not match(Mock(stderr='some text', script='vom file.py'), None)
def test_get_new_command():
with patch('thefuck.rules.no_command._get_all_bins',
return_value=['vim', 'apt-get']):
assert get_new_command(
Mock(stderr='vom: not found',
script='vom file.py'),
None) == 'vim file.py'