File: test_git_push_without_commits.py

package info (click to toggle)
thefuck 3.32-0.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,132 kB
  • sloc: python: 12,011; makefile: 5; sh: 2
file content (20 lines) | stat: -rw-r--r-- 719 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from thefuck.types import Command
from thefuck.rules.git_push_without_commits import get_new_command, match


def test_match():
    script = "git push -u origin master"
    output = "error: src refspec master does not match any\nerror: failed to..."
    assert match(Command(script, output))


def test_not_match():
    script = "git push -u origin master"
    assert not match(Command(script, "Everything up-to-date"))


def test_get_new_command():
    script = "git push -u origin master"
    output = "error: src refspec master does not match any\nerror: failed to..."
    new_command = 'git commit -m "Initial commit" && git push -u origin master'
    assert get_new_command(Command(script, output)) == new_command