def test_get_version_mocked(self, mock_stderr): argv = ['--version'] with self.assertRaises(SystemExit): shell.main(argv=argv) mock_stderr.seek(0) output = mock_stderr.read() expected = 'fastfood version %s\n' % 'custom' self.assertEqual(output, expected)
def test_get_version(self, mock_output): argv = ['--version'] with self.assertRaises(SystemExit): shell.main(argv=argv) mock_output.flush() mock_output.seek(0) output = mock_output.read() expected = 'fastfood version %s\n' % fastfood.__version__ self.assertEqual(output, expected)
def test_get_latest(self, mock_stderr): with self.vcr.use_cassette('pypi_release_info.yaml'): argv = ['--latest'] with self.assertRaises(SystemExit): shell.main(argv=argv) mock_stderr.seek(0) output = mock_stderr.read() expected = ( '%s fastfood version 0.1.6 uploaded Thu Mar 26 19:24:55 2015\n' % shell.CHECK) self.assertEqual(output, expected)