Use the producer and collector properly

This commit is contained in:
Vladan Popovic 2020-09-06 01:58:38 +02:00
parent 99a99a6122
commit 1a75b1e0b8

View file

@ -21,7 +21,7 @@ async def test_producer_called(config, event_loop):
producer.producer = Mock() producer.producer = Mock()
task = event_loop.create_task(producer.produce()) task = event_loop.create_task(producer())
await asyncio.sleep(0) await asyncio.sleep(0)
producer.producer.send_and_wait.assert_called_with( producer.producer.send_and_wait.assert_called_with(
config.kafka.topic, bytes(check.json().encode('utf-8'))) config.kafka.topic, bytes(check.json().encode('utf-8')))
@ -41,7 +41,7 @@ async def test_producer_called_invalid(config, event_loop):
producer.producer = Mock() producer.producer = Mock()
task = event_loop.create_task(producer.produce()) task = event_loop.create_task(producer())
await asyncio.sleep(0) await asyncio.sleep(0)
producer.logger.error.assert_called() producer.logger.error.assert_called()
assert task.done() assert task.done()