|
10 | 10 | class TestPaperGitCommand(object):
|
11 | 11 | """Tests for the main paper-git command."""
|
12 | 12 |
|
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. |
15 | 15 | testargs = ['paper-git']
|
16 | 16 | output = StringIO()
|
17 | 17 | with patch('sys.argv', testargs), patch('sys.stdout', output):
|
18 | 18 | with pytest.raises(SystemExit):
|
19 | 19 | main()
|
20 | 20 | 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