Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Oct 10, 2023
1 parent 3ac1ba0 commit efb029d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/aio/test_aio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import aiohttp
# noinspection PyPackageRequirements
import pytest
from aiohttp import ServerTimeoutError
from aiohttp import ServerTimeoutError, ServerConnectionError

from reportportal_client import OutputType
# noinspection PyProtectedMember
Expand Down Expand Up @@ -371,7 +371,7 @@ async def test_launch_uuid_print_default_print(mock_stdout):


def connection_error(*args, **kwargs):
raise ServerTimeoutError()
raise ServerConnectionError()


def json_error(*args, **kwargs):
Expand Down Expand Up @@ -405,8 +405,10 @@ def response_error(*args, **kwargs):
async def test_connection_errors(aio_client, requests_method, client_method,
client_params):
getattr(await aio_client.session(), requests_method).side_effect = connection_error
result = await getattr(aio_client, client_method)(*client_params)
assert result is None
try:
await getattr(aio_client, client_method)(*client_params)
except Exception as e:
assert type(e) == ServerConnectionError

getattr(await aio_client.session(), requests_method).side_effect = response_error
result = await getattr(aio_client, client_method)(*client_params)
Expand Down

0 comments on commit efb029d

Please sign in to comment.