Skip to content

Commit e445ed0

Browse files
committed
100% coverage for bin/paper_git.py.
1 parent ca2e2b4 commit e445ed0

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

papergit/tests/bin/test_commands.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,31 @@
1010
class TestPaperGitCommand(object):
1111
"""Tests for the main paper-git command."""
1212

13-
def test_basic(self):
14-
# Test that the command runs without any errors.
13+
def test_usage_with_no_arguments(self):
14+
# Test that the command runs without any arguments.
1515
testargs = ['paper-git']
1616
output = StringIO()
1717
with patch('sys.argv', testargs), patch('sys.stdout', output):
1818
with pytest.raises(SystemExit):
1919
main()
2020
assert 'usage' in output.getvalue()
21+
22+
def test_usage_with_bad_arguments(self):
23+
# Test that the command prints usage with wrong arguments.
24+
testargs = ['paper-git', 'badcommand']
25+
output = StringIO()
26+
with patch('sys.argv', testargs), patch('sys.stderr', output):
27+
with pytest.raises(SystemExit):
28+
main()
29+
assert 'usage' in output.getvalue()
30+
31+
def test_initialization(self):
32+
# Test paper-git with a valid command.
33+
testargs = ['paper-git', 'list']
34+
output = StringIO()
35+
error = StringIO()
36+
with patch('sys.argv', testargs), \
37+
patch('sys.stdout', output), patch('sys.stderr', error):
38+
main()
39+
assert '' in output.getvalue()
40+
assert '' in error.getvalue()

0 commit comments

Comments
 (0)