2017-03-22 10:23:35 +00:00
|
|
|
import pytest
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2017-03-22 10:23:35 +00:00
|
|
|
from thefuck.rules.git_push_without_commits import (
|
|
|
|
fix,
|
|
|
|
get_new_command,
|
|
|
|
match,
|
|
|
|
)
|
|
|
|
|
|
|
|
command = 'git push -u origin master'
|
|
|
|
expected_error = '''
|
|
|
|
error: src refspec master does not match any.
|
|
|
|
error: failed to push some refs to 'git@github.com:User/repo.git'
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('command', [Command(command, expected_error)])
|
2017-03-22 10:23:35 +00:00
|
|
|
def test_match(command):
|
|
|
|
assert match(command)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command, result', [(
|
2017-08-31 17:58:56 +02:00
|
|
|
Command(command, expected_error),
|
2017-03-22 10:23:35 +00:00
|
|
|
fix.format(command=command),
|
|
|
|
)])
|
|
|
|
def test_get_new_command(command, result):
|
|
|
|
assert get_new_command(command) == result
|