mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Merge pull request #201 from mcarton/whois
Add test and complete README for the `whois` rule
This commit is contained in:
commit
51800afca8
@ -171,6 +171,7 @@ using the matched rule and runs it. Rules enabled by default are as follows:
|
||||
* `ssh_known_hosts` – removes host from `known_hosts` on warning;
|
||||
* `sudo` – prepends `sudo` to previous command if it failed because of permissions;
|
||||
* `switch_layout` – switches command from your local layout to en;
|
||||
* `whois` – fixes `whois` command;
|
||||
* `apt_get` – installs app from apt if it not installed;
|
||||
* `brew_install` – fixes formula name for `brew install`;
|
||||
* `composer_not_command` – fixes composer command name.
|
||||
|
19
tests/rules/test_whois.py
Normal file
19
tests/rules/test_whois.py
Normal file
@ -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
|
@ -1,4 +1,5 @@
|
||||
from urllib.parse import urlparse
|
||||
# -*- encoding: utf-8 -*-
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
|
||||
def match(command, settings):
|
||||
|
Loading…
x
Reference in New Issue
Block a user