Exemple #1
0
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')
Exemple #2
0
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')
Exemple #3
0
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')
Exemple #4
0
 def setUp(self):
     self.default_reporter = ConsoleReporter()
     self.console = Capture()
     self.console.begin()
Exemple #5
0
 def setUp(self):
     self.default_reporter = ConsoleReporter()
Exemple #6
0
 def setUp(self):
     self.default_reporter = ConsoleReporter()