Closed analopes-creditas closed 1 year ago
Solve problem:
@mark.asyncio()
async def test_consumer_agent(
test_app, mocker, stream_key, stream_value, expected_event
):
"""Testing agent consuming events from topic source_topic and sending to topic target_topic"""
mocker.patch(
"workers.consumer.target_topic.send",
return_value=expected_event,
)
async with consumer.test_context() as agent:
event = await agent.put(key=stream_key, value=stream_value)
assert agent.results[event.message.offset] == expected_event
Checklist
master
branch of Faust.Steps to reproduce
Tell us what you did to cause something to happen.?
------ MY AGENT --------
------ MY TEST --------
---- Mock Topic ----
Expected behavior
Tell us what you expected to happen.?
I expected to run test without having a kafka instance running
Actual behavior
Tell us what happened instead.?
when my CI processes the tests I get a kafka client error as I don't have a kafka instance on the server yet. when I try to mock the topic it shows TypeError
Full traceback
---- CI ----
---- Mock ----
Versions