def test_parse_options_no_parameters(self, mock_lookup): oparser = optparse.OptionParser() cache_manage.create_options(oparser) result = self.assertRaises(SystemExit, cache_manage.parse_options, oparser, []) self.assertEqual(0, result.code) self.assertFalse(mock_lookup.called)
def test_parse_options_no_arguments(self, mock_printout): oparser = optparse.OptionParser() cache_manage.create_options(oparser) result = self.assertRaises(SystemExit, cache_manage.parse_options, oparser, ['-p', '1212']) self.assertEqual(0, result.code) self.assertTrue(mock_printout.called)
def test_parse_options_no_arguments(self, mock_printout): oparser = optparse.OptionParser() cache_manage.create_options(oparser) result = self.assertRaises(SystemExit, cache_manage.parse_options, oparser, ['-p', '1212']) self.assertEqual(result.code, 0) self.assertTrue(mock_printout.called)
def test_parse_options_no_parameters(self, mock_lookup): oparser = optparse.OptionParser() cache_manage.create_options(oparser) result = self.assertRaises(SystemExit, cache_manage.parse_options, oparser, []) self.assertEqual(result.code, 0) self.assertFalse(mock_lookup.called)
def test_parse_options_retrieve_command(self, mock_lookup): mock_lookup.return_value = True oparser = optparse.OptionParser() cache_manage.create_options(oparser) (options, command, args) = cache_manage.parse_options(oparser, ['-p', '1212', 'list-cached']) self.assertTrue(command)
def test_parse_options_no_parameters(self, mock_lookup): with mock.patch('sys.stdout', new_callable=StringIO): oparser = optparse.OptionParser() cache_manage.create_options(oparser) result = self.assertRaises(SystemExit, cache_manage.parse_options, oparser, []) self.assertEqual(0, result.code) self.assertFalse(mock_lookup.called)
def test_create_option(self): oparser = optparse.OptionParser() cache_manage.create_options(oparser) self.assertTrue(len(oparser.option_list) > 0)