Skip to content

Commit 6765d83

Browse files
committed
fix: tests
1 parent c56877d commit 6765d83

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_async_methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import typing
22
import pytest
3-
from unittest.mock import Mock, patch
3+
from unittest.mock import Mock, patch, AsyncMock
44

55
from whatsapp_api_client_python.API import GreenAPI
66

@@ -10,7 +10,7 @@
1010
class TestAsyncMethods:
1111

1212
@pytest.mark.asyncio
13-
@patch("whatsapp_api_client_python.API.Session.request")
13+
@patch("whatsapp_api_client_python.API.Session.request", new_callable=AsyncMock)
1414
async def test_async_methods(self, mock_raw_request):
1515
# Создаем мок-ответы с разными кодами статуса
1616
mock_responses = [
@@ -20,7 +20,7 @@ async def test_async_methods(self, mock_raw_request):
2020
]
2121

2222
# Настраиваем мок чтобы он возвращал разные ответы по очереди
23-
mock_raw_request.side_effect = mock_responses * 10 # Умножаем чтобы хватило на все вызовы
23+
mock_raw_request.side_effect = mock_responses * 20 # Умножаем чтобы хватило на все вызовы
2424

2525
methods_coroutines = []
2626
methods_coroutines.extend(self.account_methods())

0 commit comments

Comments
 (0)