mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Not matched unit tests, code style.
This commit is contained in:
parent
004c0d06eb
commit
7cb0388ed0
@ -13,6 +13,15 @@ def test_match(command):
|
||||
assert match(command, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='vagrant ssh', stderr=''),
|
||||
Command(script='vagrant ssh jeff', stderr='The machine with the name \'jeff\' was not found configured for this Vagrant environment.'),
|
||||
Command(script='vagrant ssh', stderr='A Vagrant environment or target machine is required to run this command. Run `vagrant init` to create a new Vagrant environment. Or, get an ID of a target machine from `vagrant global-status` to run this command on. A final option is to change to a directory with a Vagrantfile and to try again.'),
|
||||
Command()])
|
||||
def test_not_match(command):
|
||||
assert not match(command, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command(script='vagrant ssh', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), 'vagrant up && vagrant ssh'),
|
||||
(Command(script='vagrant ssh devbox', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), 'vagrant up devbox && vagrant ssh devbox'),
|
||||
|
@ -4,9 +4,10 @@ from thefuck import shells
|
||||
def match(command, settings):
|
||||
return command.script.startswith('vagrant ') and 'run `vagrant up`' in command.stderr.lower()
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
cmds = command.script.split(' ')
|
||||
machine = ""
|
||||
if len(cmds) >= 3:
|
||||
machine = cmds[2]
|
||||
return "vagrant up " + machine + " && " + command.script
|
||||
return shells.and_("vagrant up " + machine, command.script)
|
||||
|
Loading…
x
Reference in New Issue
Block a user