def test_start(self): yield self.assert_status('stopped') lc = LogCatcher() with lc: yield self.rtr_helper.start_router(self.router) self.assertEqual(lc.messages(), [ u"Starting router '%s' for user 'test-0-user'." % self.router.key, ]) yield self.assert_status('running')
def test_message_concatenation(self): lc = LogCatcher() with lc: log.info("Part 1", "Part 2") self.assertEqual(lc.messages(), ["Part 1 Part 2"])
def test_message_filtering(self): lc = LogCatcher(message="^Keep") with lc: log.info("Keep this") log.info("Discard this") self.assertEqual(lc.messages(), ["Keep this"])
def test_system_filtering(self): lc = LogCatcher(system="^ab") with lc: log.info("Test 1", system="abc") log.info("Test 2", system="def") self.assertEqual(lc.messages(), ["Test 1"])
def test_simple_catching(self): lc = LogCatcher() with lc: log.info("Test") self.assertEqual(lc.messages(), ["Test"])