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.')
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)
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)
def test_kind(self): self.assertEqual(GlobalBear.kind(), BEAR_KIND.GLOBAL)
def __init__(self): GlobalBear.__init__(self, {}, Section("irrelevant"), None)
def test_api(self): test_object = GlobalBear(0, Section("name"), None) self.assertRaises(NotImplementedError, test_object.run)
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)
def test_run_raises(self): bear = GlobalBear(None, Section(''), None) self.assertRaises(NotImplementedError, bear.run)