Skip to content

Commit

Permalink
chore: small improvements on asyncs
Browse files Browse the repository at this point in the history
  • Loading branch information
domenicoblanco committed May 30, 2022
1 parent b6d9276 commit f30ba78
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/main_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from pytest_mock import MockerFixture
from unittest.mock import AsyncMock
import src.main as main


Expand Down Expand Up @@ -65,15 +66,15 @@
'arg': ('http://example.com', 'get'),
'mock_obj': [main],
'mock_func': ['run'],
'mock_ret': [True]
'mock_ret': [AsyncMock(return_value=True)]
},
{
'func': main.handle_urls,
'expected_res': None,
'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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit f30ba78

Please sign in to comment.