def setUp(self): self.stdout = StringIO() self.reactor = TerminalReporter(self.stdout)
def setUp(self): self.stdout = six.StringIO() self.reactor = TerminalReporter(self.stdout)
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)
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)