mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-11 06:13:58 +01:00
Move all app/os specific utils to specific
package
This commit is contained in:
29
tests/specific/test_git.py
Normal file
29
tests/specific/test_git.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import pytest
|
||||
from thefuck.specific.git import git_support
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('called, command, stderr', [
|
||||
('git co', 'git checkout', "19:22:36.299340 git.c:282 trace: alias expansion: co => 'checkout'"),
|
||||
('git com file', 'git commit --verbose file',
|
||||
"19:23:25.470911 git.c:282 trace: alias expansion: com => 'commit' '--verbose'")])
|
||||
def test_git_support(called, command, stderr):
|
||||
@git_support
|
||||
def fn(command, settings): return command.script
|
||||
|
||||
assert fn(Command(script=called, stderr=stderr), None) == command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, is_git', [
|
||||
('git pull', True),
|
||||
('hub pull', True),
|
||||
('git push --set-upstream origin foo', True),
|
||||
('hub push --set-upstream origin foo', True),
|
||||
('ls', False),
|
||||
('cat git', False),
|
||||
('cat hub', False)])
|
||||
def test_git_support_match(command, is_git):
|
||||
@git_support
|
||||
def fn(command, settings): return True
|
||||
|
||||
assert fn(Command(script=command), None) == is_git
|
Reference in New Issue
Block a user