1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_whois.py

30 lines
953 B
Python
Raw Normal View History

2015-05-16 14:36:27 +01:00
import pytest
from thefuck.rules.whois import match, get_new_command
from thefuck.types import Command
2015-05-16 14:36:27 +01:00
@pytest.mark.parametrize('command', [
Command('whois https://en.wikipedia.org/wiki/Main_Page', ''),
Command('whois https://en.wikipedia.org/', ''),
Command('whois meta.unix.stackexchange.com', '')])
2015-05-16 14:36:27 +01:00
def test_match(command):
assert match(command)
2015-05-16 14:36:27 +01:00
def test_not_match():
assert not match(Command('whois', ''))
2015-07-31 21:12:10 +01:00
# `whois com` actually makes sense
2015-05-16 14:36:27 +01:00
@pytest.mark.parametrize('command, new_command', [
(Command('whois https://en.wikipedia.org/wiki/Main_Page', ''),
'whois en.wikipedia.org'),
(Command('whois https://en.wikipedia.org/', ''),
'whois en.wikipedia.org'),
(Command('whois meta.unix.stackexchange.com', ''),
['whois unix.stackexchange.com',
'whois stackexchange.com',
'whois com'])])
2015-05-16 14:36:27 +01:00
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command