File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11import typing
22import pytest
3- from unittest .mock import Mock , patch
3+ from unittest .mock import Mock , patch , AsyncMock
44
55from whatsapp_api_client_python .API import GreenAPI
66
1010class 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 ())
You can’t perform that action at this time.
0 commit comments