mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-27 23:52:41 +01:00
Rules: git remote add instead of set-url if remote does not exist
Tests: Added test for git_remote_seturl_add Rules: renamed new rule with a more appropriate name README: added new rule Style: Formatting New rule: corrected test name Developed tests
This commit is contained in:
committed by
Paul-Louis NECH
parent
019f0abf67
commit
04b83cf7e8
26
tests/rules/test_git_remote_seturl_add.py
Normal file
26
tests/rules/test_git_remote_seturl_add.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import pytest
|
||||
from thefuck.rules.git_remote_seturl_add import match, get_new_command
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='git remote set-url origin url', stderr="fatal: No such remote")])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('git remote set-url origin url', stderr=""),
|
||||
Command('git remote add origin url'),
|
||||
Command('git remote remove origin'),
|
||||
Command('git remote prune origin'),
|
||||
Command('git remote set-branches origin branch')
|
||||
])
|
||||
def test_not_match(command):
|
||||
assert not match(command)
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('git remote set-url origin git@github.com:nvbn/thefuck.git'),
|
||||
'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
|
Reference in New Issue
Block a user