def _assert_logged(self, mock_logger, expected_log_msg): """Assert that the log() method was called on the mock_logger with expected params""" mock_logger.log.assert_called_with( scalyr_logging.DEBUG_LEVEL_1, expected_log_msg, limit_once_per_x_secs=300, limit_key='query-api-log-resp-%s' % md5_hexdigest(self._path))
def _get_debug_call(self, expected_log_msg): """Return a mock call object that captures the param values of the log() call""" debug_log_call = call.log( scalyr_logging.DEBUG_LEVEL_1, expected_log_msg, limit_once_per_x_secs=300, limit_key='query-api-log-resp-%s' % md5_hexdigest(self._path)) return debug_log_call
def test_query_api_ratelimit(self): """Fails to satisfy minimum latency. Not logged""" kapi = KubernetesApi(log_api_responses=True, log_api_ratelimit_interval=77) mock_logger, expected_log_msg = self._simulate_response(kapi, 200) mock_logger.log.assert_called_with( scalyr_logging.DEBUG_LEVEL_1, expected_log_msg, limit_once_per_x_secs=77, limit_key='query-api-log-resp-%s' % md5_hexdigest(self._path))