def test_ignore_self_logs(self): self.setUpClient() handler = register_logging() self.client.py_report(TEST_ENVIRON, http_status=500) self.client.py_slow_report(TEST_ENVIRON, start_time=REQ_START_TIME, end_time=REQ_END_TIME) self.client.py_log(TEST_ENVIRON, records=handler.get_records()) self.assertEqual(len(self.client.log_queue), 0)
def test_py_log(self): self.setUpClient() handler = register_logging() logger = logging.getLogger('testing') logger.critical('test entry') self.client.py_log(TEST_ENVIRON, records=handler.get_records()) fake_log = {'log_level': 'CRITICAL', 'namespace': 'testing', 'server': 'test-foo', # this will be different everywhere 'request_id': None, 'date': '2012-08-13T21:20:37.418.307066', 'message': 'test entry'} # update fields depenand on machine self.client.log_queue[0]['date'] = fake_log['date'] self.client.log_queue[0]['server'] = fake_log['server'] self.assertEqual(self.client.log_queue[0], fake_log)