From f30ba78aa73eef0a4a7e503e5df69609531b5792 Mon Sep 17 00:00:00 2001 From: Domenico Blanco Date: Mon, 30 May 2022 10:17:48 +0200 Subject: [PATCH] chore: small improvements on asyncs --- tests/main_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/main_test.py b/tests/main_test.py index 5d11e11..130f6da 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -1,5 +1,6 @@ import pytest from pytest_mock import MockerFixture +from unittest.mock import AsyncMock import src.main as main @@ -65,7 +66,7 @@ 'arg': ('http://example.com', 'get'), 'mock_obj': [main], 'mock_func': ['run'], - 'mock_ret': [True] + 'mock_ret': [AsyncMock(return_value=True)] }, { 'func': main.handle_urls, @@ -73,7 +74,7 @@ 'arg': ('http://example.com', 'get'), 'mock_obj': [main, main], 'mock_func': ['run', 'handle_communication'], - 'mock_ret': [False, None] + 'mock_ret': [AsyncMock(return_value=False), None] }, { 'func': main.handle_urls, @@ -105,7 +106,7 @@ 'arg': ('http://example.com', 'get'), 'mock_obj': [main, main], 'mock_func': ['get_users', 'run'], - 'mock_ret': [['12345678'], {"ok":True,"error_code":429,"description":"Unauthorized"}] + 'mock_ret': [['12345678'], {"ok":True,"error_code":429,"description":"Fine"}] }, { 'func': main.handle_communication, @@ -147,5 +148,4 @@ def test_init(mocker: MockerFixture) -> None: mocker.patch.object(main, "__name__", "__main__") mocker.patch.object(main, 'main', return_value=None) - assert main.init() == None - + assert main.init() == None \ No newline at end of file