class TestConsoleReporter(TestCase): def setUp(self): self.default_reporter = ConsoleReporter() def _get_output(self): stdout, _ = self.capfd.readouterr() return stdout def test_get_name(self): self.assertEqual(self.default_reporter.get_name(), 'Simple BDD Serial console reporter') def test_process_args(self): class dotted_dict(object): def __getattr__(self, attr): return self.__dict__.get(attr) args = dotted_dict() args.no_color = True self.default_reporter.process_arguments(args) self.assertFalse(self.default_reporter.use_color) def test_no_color_print(self): self.default_reporter.use_color = False self.default_reporter.output('test', 0, TestStatus.PASS) self.assertEqual(self._get_output(), 'test\n') def test_color_print(self): self.default_reporter.output('test', 0, TestStatus.PASS) self.assertEqual(self._get_output(), '\x1b[32mtest\x1b[0m\n')
class TestConsoleReporter(TestCase): def setUp(self): self.default_reporter = ConsoleReporter() def test_get_name(self): self.assertEqual(self.default_reporter.get_name(), 'Temporary console reporter') def test_process_args(self): class dotted_dict(object): def __getattr__(self, attr): return self.__dict__.get(attr) args = dotted_dict() args.no_color = True self.default_reporter.process_arguments(args) self.assertFalse(self.default_reporter.use_color) def test_no_color_print(self): self.default_reporter.use_color = False self.default_reporter.print_colored('bam')
def setUp(self): self.default_reporter = ConsoleReporter() self.console = Capture() self.console.begin()
def setUp(self): self.default_reporter = ConsoleReporter()