def test_bad_file(self): bad_file = os.path.join(self.base_test_path, 'bad_code.java') with open(bad_file) as file: bad_filelines = file.readlines() self.uut = CPDBear({bad_file: bad_filelines}, self.section, self.queue) result = list(self.uut.run_bear_from_section([], {})) self.assertNotEqual(result, [])
def test_unsupported_language(self): self.section.update_setting(key='language', new_value='html') self.section.language = Language['html'] self.uut = CPDBear({'file_name': 'hello world \n'}, self.section, self.queue) list(self.uut.run_bear_from_section([], {})) self.assertEqual(self.uut.message_queue.queue[0].log_level, logging.ERROR) self.assertIn('Hypertext Markup Language', self.uut.message_queue.queue[0].message)