Skip to content

Commit

Permalink
tests: fix kafka warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed May 9, 2024
1 parent 1227488 commit 2ad2d1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions faststream/confluent/testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, MagicMock

from typing_extensions import override

Expand Down Expand Up @@ -240,4 +240,7 @@ def build_message(


def _fake_connection(*args: Any, **kwargs: Any) -> AsyncMock:
return AsyncMock()
mock = AsyncMock()
mock.getone.return_value = MagicMock()
mock.getmany.return_value = [MagicMock()]
return mock
7 changes: 5 additions & 2 deletions faststream/kafka/testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, MagicMock

from aiokafka import ConsumerRecord
from typing_extensions import override
Expand Down Expand Up @@ -210,4 +210,7 @@ def build_message(


def _fake_connection(*args: Any, **kwargs: Any) -> AsyncMock:
return AsyncMock()
mock = AsyncMock()
mock.subscribe = MagicMock
mock.assign = MagicMock
return mock

0 comments on commit 2ad2d1f

Please sign in to comment.