def test_large_streaming_query(self):
"""
Tests the start method for a Pump with a streaming Pipe and a query that
exceeds the Pipe's specs.
"""
with LogCapture() as log_capture:
self.stream_pump._factor_query = Mock(return_value=self.query_list)
self.stream_pump._process_streaming_query = Mock()
self.stream_pump.start(self.query)
# check that _factor_query() was called with the value that was
# passed to start()
self.stream_pump._factor_query.assert_called_once_with(self.query)
# check that _process_nonstreaming_queries() was called with the
# first element of the query list returned by _factor_query()
self.stream_pump._process_streaming_query.assert_called_once_with(
self.query_list[0])
# check that a warning was generated
msg = 'Query was too large for Pipe "Twitter PublicStreamsAPI." ' \
+ 'A smaller version of the query was submitted.'
log_capture.check(
('aggregator.pumproom.pump', 'WARNING', msg),
)
评论列表
文章目录