Skip to content

Commit 6d291ab

Browse files
committed
test: fix some broken tests because typing
1 parent db36a18 commit 6d291ab

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

tests/infra/http/client/test_aiohttp_adapter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import inspect
2-
from typing import Any, Self
2+
from typing import Any
33
from unittest.mock import AsyncMock
44

55
from system_notification.infra.http.client.aiohttp_adapter import AioHttpAdapter
@@ -23,17 +23,17 @@ def request(self, *args, **kwargs) -> Any:
2323
async def read(self) -> Any:
2424
self.read_is_called = True
2525

26-
async def __aenter__(self) -> Self:
26+
async def __aenter__(self) -> "ClientSessionFake":
2727
return self
2828

2929
async def __aexit__(self, *args, **kwargs) -> None:
3030
pass
3131

3232

33-
async def test_make_async_returns_a_coroutine() -> None:
33+
async def test_make_async_returns_an_object_where_json_mehod_is_a_couroutine() -> None:
3434
sut = AioHttpAdapter()
3535
output = await sut._make_async(data=AsyncMock())
36-
assert inspect.iscoroutinefunction(output)
36+
assert inspect.iscoroutinefunction(output.json)
3737

3838

3939
async def test_get_method_calls_make_request() -> None:

tests/infra/http/controller/test_send_notification_controller.py

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ async def test_ensure_usecase_is_called_with_right_params() -> None:
9191
target=[NotificationTarget(_type="slack_channel", _target="tech_logs")],
9292
priority=0,
9393
placeholders={},
94+
icon=None,
9495
)
9596
)
9697

@@ -115,5 +116,6 @@ def execute(*args, **kwargs):
115116
target=[NotificationTarget(_type="slack_channel", _target="tech_logs")],
116117
priority=0,
117118
placeholders={},
119+
icon=None,
118120
)
119121
)

tests/infra/notifications_handlers/test_slack_notification_handler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Tuple
1+
from typing import Any, Dict, Tuple, Union
22

33
import pytest
44
from slack_sdk.errors import SlackApiError
@@ -19,7 +19,7 @@ class SlackFakeClient:
1919
def __init__(
2020
self,
2121
as_success: bool = True,
22-
raises_with: Tuple[str, Dict[str, str]] | Tuple = (),
22+
raises_with: Union[Tuple[str, Dict[str, str]], Tuple] = (),
2323
) -> None:
2424
self.raises_with = raises_with
2525
self.as_success = as_success

0 commit comments

Comments
 (0)