1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-27 15:42:37 +01:00

Make Changes suggested by @nvbn

* remove comments/doctrings at the top of files;
* move sudo-related stuff to sudo rule;
* for no_command case try to find most similar command, like, for example, in react_native_command_unrecognized rule.
This commit is contained in:
dhilipsiva
2017-02-09 08:46:54 +05:30
parent fb07cdfb4a
commit 7f9025c7ad
3 changed files with 11 additions and 48 deletions

View File

@@ -1,20 +1,6 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: test_hostscli.py
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2017-02-05
"""
import pytest
from thefuck.rules.hostscli import no_command, need_sudo, no_website, \
match, get_new_command
from thefuck.rules.hostscli import no_command, no_website, get_new_command, \
match
from tests.utils import Command
@@ -24,14 +10,6 @@ Usage: hostscli [OPTIONS] COMMAND [ARGS]...
%s "invalid".
''' % no_command
need_sudo = '''
%s:
"sudo" permissions are required to run this command.
Please run the last command again with sudo
''' % need_sudo
no_website = '''
%s:
@@ -54,9 +32,6 @@ def test_match(command):
@pytest.mark.parametrize('command, result', [
(Command(
'hostscli invalid', stderr=no_command), ['hostscli --help']),
(Command(
'hostscli block test', stderr=need_sudo),
['sudo hostscli block test']),
(Command(
'sudo hostscli block a_website_that_does_not_exist',
stderr=no_website),