Esempio n. 1
0
 def test_print_no_filename_GlobalBear(self):
     self.uut = GlobalBear(None, self.settings, self.queue)
     self.uut.execute()
     self.check_message(LOG_LEVEL.DEBUG)
     # Fails because of no run() implementation
     self.check_message(
         LOG_LEVEL.ERROR, 'Bear GlobalBear failed to run. Take a look at '
         'debug messages (`-V`) for further '
         'information.')
Esempio n. 2
0
    def test_file_dict(self):
        file_dict_0 = {'filename1': 'contents1', 'filename2': 'contents2'}

        # check that bear does not modify original dictionary
        file_dict_1 = file_dict_0.copy()

        bear = GlobalBear(file_dict_0, Section(''), None)

        self.assertEqual(bear.file_dict, file_dict_0)
        self.assertEqual(bear.file_dict, file_dict_1)
Esempio n. 3
0
 def test_no_warning_debug_enabled_GlobalBear(self):
     self.settings.append(Setting('log_level', 'DEBUG'))
     self.uut = GlobalBear(None, self.settings, self.queue)
     self.uut.execute()
     self.check_message(LOG_LEVEL.DEBUG, 'Running bear GlobalBear...')
     # Fails because of no run() implementation
     self.check_message(
         LOG_LEVEL.DEBUG, 'The bear GlobalBear raised an exception. If you '
         'are the author of this bear, please make sure to '
         'catch all exceptions. If not and this error '
         'annoys you, you might want to get in contact with '
         'the author of this bear.\n\nTraceback information '
         'is provided below:', True)
     self.assertRaises(NotImplementedError)
Esempio n. 4
0
 def test_kind(self):
     self.assertEqual(GlobalBear.kind(), BEAR_KIND.GLOBAL)
Esempio n. 5
0
 def __init__(self):
     GlobalBear.__init__(self, {}, Section("irrelevant"), None)
Esempio n. 6
0
 def __init__(self):
     GlobalBear.__init__(self, {}, Section("irrelevant"), None)
Esempio n. 7
0
 def test_api(self):
     test_object = GlobalBear(0, Section("name"), None)
     self.assertRaises(NotImplementedError, test_object.run)
Esempio n. 8
0
 def test_kind(self):
     self.assertEqual(GlobalBear.kind(), BEAR_KIND.GLOBAL)
Esempio n. 9
0
    def test_kind_is_staticmethod(self):
        self.assertEqual(GlobalBear.kind(), BEAR_KIND.GLOBAL)

        bear = GlobalBear(None, Section(''), None)
        self.assertEqual(bear.kind(), BEAR_KIND.GLOBAL)
Esempio n. 10
0
    def test_kind_is_staticmethod(self):
        self.assertEqual(GlobalBear.kind(), BEAR_KIND.GLOBAL)

        bear = GlobalBear(None, Section(''), None)
        self.assertEqual(bear.kind(), BEAR_KIND.GLOBAL)
Esempio n. 11
0
 def test_run_raises(self):
     bear = GlobalBear(None, Section(''), None)
     self.assertRaises(NotImplementedError, bear.run)