2016-03-04 13:47:07 +01:00
|
|
|
import pytest
|
|
|
|
from thefuck.rules.git_remote_seturl_add import match, get_new_command
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2016-03-04 13:47:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
Command('git remote set-url origin url', "fatal: No such remote")])
|
2016-03-04 13:47:07 +01:00
|
|
|
def test_match(command):
|
|
|
|
assert match(command)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
Command('git remote set-url origin url', ""),
|
|
|
|
Command('git remote add origin url', ''),
|
|
|
|
Command('git remote remove origin', ''),
|
|
|
|
Command('git remote prune origin', ''),
|
|
|
|
Command('git remote set-branches origin branch', '')])
|
2016-03-04 13:47:07 +01:00
|
|
|
def test_not_match(command):
|
|
|
|
assert not match(command)
|
|
|
|
|
2016-10-05 11:20:42 -04:00
|
|
|
|
2016-03-04 13:47:07 +01:00
|
|
|
@pytest.mark.parametrize('command, new_command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
(Command('git remote set-url origin git@github.com:nvbn/thefuck.git', ''),
|
2016-03-04 13:47:07 +01:00
|
|
|
'git remote add origin git@github.com:nvbn/thefuck.git')])
|
|
|
|
def test_get_new_command(command, new_command):
|
|
|
|
assert get_new_command(command) == new_command
|