mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-09 05:14:00 +01:00
Added a rule to match az binary sub-command misses (#834)
This commit is contained in:
committed by
Vladimir Iakovlev
parent
9d46291944
commit
926e9ef963
44
tests/rules/test_az_cli.py
Normal file
44
tests/rules/test_az_cli.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import pytest
|
||||
|
||||
from thefuck.rules.az_cli import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
no_suggestions = '''\
|
||||
az provider: error: the following arguments are required: _subcommand
|
||||
usage: az provider [-h] {list,show,register,unregister,operation} ...
|
||||
'''
|
||||
|
||||
|
||||
misspelled_command = '''\
|
||||
az: 'providers' is not in the 'az' command group. See 'az --help'.
|
||||
|
||||
The most similar choice to 'providers' is:
|
||||
provider
|
||||
'''
|
||||
|
||||
misspelled_subcommand = '''\
|
||||
az provider: 'lis' is not in the 'az provider' command group. See 'az provider --help'.
|
||||
|
||||
The most similar choice to 'lis' is:
|
||||
list
|
||||
'''
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('az providers', misspelled_command),
|
||||
Command('az provider lis', misspelled_subcommand)])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
def test_not_match():
|
||||
assert not match(Command('az provider', no_suggestions))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, result', [
|
||||
(Command('az providers list', misspelled_command), ['az provider list']),
|
||||
(Command('az provider lis', misspelled_subcommand), ['az provider list'])
|
||||
])
|
||||
def test_get_new_command(command, result):
|
||||
assert get_new_command(command) == result
|
Reference in New Issue
Block a user