Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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)
Пример #7
0
    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_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)
Пример #9
0
 def test_create_option(self):
     oparser = optparse.OptionParser()
     cache_manage.create_options(oparser)
     self.assertTrue(len(oparser.option_list) > 0)
Пример #10
0
 def test_create_option(self):
     oparser = optparse.OptionParser()
     cache_manage.create_options(oparser)
     self.assertTrue(len(oparser.option_list) > 0)