look for correct stdout
This commit is contained in:
parent
ca486e2ac6
commit
4284fe9415
1 changed files with 4 additions and 3 deletions
|
@ -29,10 +29,11 @@ class BaseTestCase(utils.TestCase):
|
||||||
response = Response()
|
response = Response()
|
||||||
response.status_code = 201
|
response.status_code = 201
|
||||||
mock_requests.return_value = response
|
mock_requests.return_value = response
|
||||||
args = ['', '--file', 'tests/samples/emptyfile.txt', '--key', '123']
|
args = ['', '--file', 'tests/samples/emptyfile.txt', '--key', '123', '--config', 'foo']
|
||||||
retval = main(args)
|
retval = main(args)
|
||||||
self.assertEquals(retval, 0)
|
self.assertEquals(retval, 0)
|
||||||
self.assertEquals(sys.stdout.getvalue(), '')
|
expected_stdout = u("Error: Could not read from config file foo\n")
|
||||||
|
self.assertEquals(sys.stdout.getvalue(), expected_stdout)
|
||||||
self.assertEquals(sys.stderr.getvalue(), '')
|
self.assertEquals(sys.stderr.getvalue(), '')
|
||||||
|
|
||||||
def test_missing_config_file(self, mock_requests):
|
def test_missing_config_file(self, mock_requests):
|
||||||
|
@ -58,5 +59,5 @@ class BaseTestCase(utils.TestCase):
|
||||||
args = ['', '--file', 'tests/samples/emptyfile.txt', '--config', 'tests/samples/bad_config.cfg']
|
args = ['', '--file', 'tests/samples/emptyfile.txt', '--config', 'tests/samples/bad_config.cfg']
|
||||||
retval = main(args)
|
retval = main(args)
|
||||||
self.assertEquals(retval, 103)
|
self.assertEquals(retval, 103)
|
||||||
self.assertTrue('ParsingError' in sys.stdout.getvalue())
|
self.assertIn('ParsingError', sys.stdout.getvalue())
|
||||||
self.assertEquals(sys.stderr.getvalue(), '')
|
self.assertEquals(sys.stderr.getvalue(), '')
|
||||||
|
|
Loading…
Reference in a new issue