From 6539c853b4838c7c6ea049604ddb5bcd024ad6ba Mon Sep 17 00:00:00 2001 From: mcarton Date: Sat, 16 May 2015 15:36:27 +0200 Subject: [PATCH] Add tests for the `whois` rule --- tests/rules/test_whois.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/rules/test_whois.py diff --git a/tests/rules/test_whois.py b/tests/rules/test_whois.py new file mode 100644 index 00000000..b911106e --- /dev/null +++ b/tests/rules/test_whois.py @@ -0,0 +1,19 @@ +import pytest +from thefuck.rules.whois import match, get_new_command +from tests.utils import Command + + +@pytest.mark.parametrize('command', [ + Command(script='whois https://en.wikipedia.org/wiki/Main_Page'), + Command(script='whois https://en.wikipedia.org/'), + Command(script='whois en.wikipedia.org')]) +def test_match(command): + assert match(command, None) + + +@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 en.wikipedia.org'), 'whois wikipedia.org')]) +def test_get_new_command(command, new_command): + assert get_new_command(command, None) == new_command