Esempio n. 1
0
 def setUp(self):
     self.stdout = StringIO()
     self.reactor = TerminalReporter(self.stdout)
Esempio n. 2
0
 def setUp(self):
     self.stdout = six.StringIO()
     self.reactor = TerminalReporter(self.stdout)
Esempio n. 3
0
class TestTerminalReactor(unittest.TestCase):
    def setUp(self):
        self.stdout = StringIO()
        self.reactor = TerminalReporter(self.stdout)

    def tearDown(self):
        self.stdout.close()

    def test_react_on_success(self):
        self.reactor.start()
        self.reactor.feed(b"hello")
        self.reactor.stop(0)
        output = self.stdout.getvalue()
        self.assert_("hello" in output)
        self.assert_("OK" in output)

    def test_react_on_failure(self):
        self.reactor.start()
        self.reactor.feed(b"world")
        self.reactor.stop(1)
        output = self.stdout.getvalue()
        self.assert_("world" in output)
        self.assert_("ERROR" in output)
Esempio n. 4
0
class TestTerminalReactor(unittest.TestCase):

    def setUp(self):
        self.stdout = six.StringIO()
        self.reactor = TerminalReporter(self.stdout)

    def tearDown(self):
        self.stdout.close()

    def test_react_on_success(self):
        self.reactor.start()
        self.reactor.feed("hello")
        self.reactor.stop(0)
        output = self.stdout.getvalue()
        self.assert_("hello" in output)
        self.assert_("OK" in output)

    def test_react_on_failure(self):
        self.reactor.start()
        self.reactor.feed("world")
        self.reactor.stop(1)
        output = self.stdout.getvalue()
        self.assert_("world" in output)
        self.assert_("ERROR" in output)