From 47d86c4a7f4c20f31b7cf29f426414b891fecd97 Mon Sep 17 00:00:00 2001 From: Nikolay Kiryanov Date: Sat, 8 Jun 2024 17:15:57 +0300 Subject: [PATCH] Rename `WebSocketMessageHandler` to `WebSocketMessagesHandler` --- src/handlers/__init__.py | 4 ++-- .../{message_handler.py => messages_handler.py} | 2 +- src/handlers/tests/message_handler/conftest.py | 4 ++-- .../message_handler/tests_auth_message_handler.py | 4 ++-- .../message_handler/tests_message_handler_common.py | 10 +++++----- .../message_handler/tests_subscirbe_message_handler.py | 4 ++-- .../tests_unsubscirbe_message_handler.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) rename src/handlers/{message_handler.py => messages_handler.py} (98%) diff --git a/src/handlers/__init__.py b/src/handlers/__init__.py index 50a2763..bde0951 100644 --- a/src/handlers/__init__.py +++ b/src/handlers/__init__.py @@ -1,5 +1,5 @@ -from handlers.message_handler import WebSocketMessageHandler +from handlers.messages_handler import WebSocketMessagesHandler __all__ = [ - "WebSocketMessageHandler", + "WebSocketMessagesHandler", ] diff --git a/src/handlers/message_handler.py b/src/handlers/messages_handler.py similarity index 98% rename from src/handlers/message_handler.py rename to src/handlers/messages_handler.py index 747fcbf..79733ca 100644 --- a/src/handlers/message_handler.py +++ b/src/handlers/messages_handler.py @@ -22,7 +22,7 @@ @dataclass -class WebSocketMessageHandler: +class WebSocketMessagesHandler: storage: SubscriptionStorage def __post_init__(self) -> None: diff --git a/src/handlers/tests/message_handler/conftest.py b/src/handlers/tests/message_handler/conftest.py index 4ff9b92..bd3bc4c 100644 --- a/src/handlers/tests/message_handler/conftest.py +++ b/src/handlers/tests/message_handler/conftest.py @@ -1,6 +1,6 @@ import pytest -from handlers import WebSocketMessageHandler +from handlers import WebSocketMessagesHandler from handlers.dto import AuthMessage, SubscribeMessage, UnsubscribeMessage @@ -18,7 +18,7 @@ def force_token_on_validation(mocker, valid_token): @pytest.fixture def message_handler(storage): - return WebSocketMessageHandler(storage=storage) + return WebSocketMessagesHandler(storage=storage) @pytest.fixture diff --git a/src/handlers/tests/message_handler/tests_auth_message_handler.py b/src/handlers/tests/message_handler/tests_auth_message_handler.py index 75c288c..28cc917 100644 --- a/src/handlers/tests/message_handler/tests_auth_message_handler.py +++ b/src/handlers/tests/message_handler/tests_auth_message_handler.py @@ -4,7 +4,7 @@ from app.types import DecodedValidToken from handlers.dto import SuccessResponseMessage from handlers.exceptions import WebsocketMessageException -from handlers import WebSocketMessageHandler +from handlers import WebSocketMessagesHandler from storage.storage_updaters import StorageWebSocketRegister pytestmark = [ @@ -18,7 +18,7 @@ def ya_user_decoded_valid_token(): @pytest.fixture -def auth_handler(message_handler: WebSocketMessageHandler, ws): +def auth_handler(message_handler: WebSocketMessagesHandler, ws): return lambda auth_message: message_handler.handle_auth_message(ws, auth_message) diff --git a/src/handlers/tests/message_handler/tests_message_handler_common.py b/src/handlers/tests/message_handler/tests_message_handler_common.py index e438a51..25e47d2 100644 --- a/src/handlers/tests/message_handler/tests_message_handler_common.py +++ b/src/handlers/tests/message_handler/tests_message_handler_common.py @@ -1,10 +1,10 @@ import pytest -from handlers.message_handler import WebSocketMessageHandler +from handlers.messages_handler import WebSocketMessagesHandler @pytest.fixture def get_message_handler(storage): - return lambda: WebSocketMessageHandler(storage) + return lambda: WebSocketMessagesHandler(storage) def test_message_handler_jwk_client_settings(message_handler): @@ -14,7 +14,7 @@ def test_message_handler_jwk_client_settings(message_handler): @pytest.mark.usefixtures("force_token_on_validation") async def test_message_handler_call_auth_handler_on_auth_message(get_message_handler, auth_message, mocker, ws): - spy_auth_handler = mocker.spy(WebSocketMessageHandler, "handle_auth_message") + spy_auth_handler = mocker.spy(WebSocketMessagesHandler, "handle_auth_message") await get_message_handler().handle_message(ws, auth_message) @@ -22,7 +22,7 @@ async def test_message_handler_call_auth_handler_on_auth_message(get_message_han async def test_message_handler_call_subscribe_handler_on_subscribe_message(get_message_handler, subscribe_message, mocker, ws_registered): - spy_subscribe_handler = mocker.spy(WebSocketMessageHandler, "handle_subscribe_message") + spy_subscribe_handler = mocker.spy(WebSocketMessagesHandler, "handle_subscribe_message") await get_message_handler().handle_message(ws_registered, subscribe_message) @@ -30,7 +30,7 @@ async def test_message_handler_call_subscribe_handler_on_subscribe_message(get_m async def test_message_handler_call_unsubscribe_handler_on_unsubscribe_message(get_message_handler, unsubscribe_message, mocker, ws_subscribed): - spy_unsubscribe_handler = mocker.spy(WebSocketMessageHandler, "handle_unsubscribe_message") + spy_unsubscribe_handler = mocker.spy(WebSocketMessagesHandler, "handle_unsubscribe_message") await get_message_handler().handle_message(ws_subscribed, unsubscribe_message) diff --git a/src/handlers/tests/message_handler/tests_subscirbe_message_handler.py b/src/handlers/tests/message_handler/tests_subscirbe_message_handler.py index e51ff0b..f266259 100644 --- a/src/handlers/tests/message_handler/tests_subscirbe_message_handler.py +++ b/src/handlers/tests/message_handler/tests_subscirbe_message_handler.py @@ -1,10 +1,10 @@ import pytest -from handlers.message_handler import WebSocketMessageHandler +from handlers.messages_handler import WebSocketMessagesHandler from storage.storage_updaters import StorageUserSubscriber @pytest.fixture -def subscribe_handler(message_handler: WebSocketMessageHandler, ws_registered): +def subscribe_handler(message_handler: WebSocketMessagesHandler, ws_registered): return lambda subscribe_message: message_handler.handle_subscribe_message(ws_registered, subscribe_message) diff --git a/src/handlers/tests/message_handler/tests_unsubscirbe_message_handler.py b/src/handlers/tests/message_handler/tests_unsubscirbe_message_handler.py index 7b5b1ce..61e5c55 100644 --- a/src/handlers/tests/message_handler/tests_unsubscirbe_message_handler.py +++ b/src/handlers/tests/message_handler/tests_unsubscirbe_message_handler.py @@ -1,10 +1,10 @@ import pytest -from handlers.message_handler import WebSocketMessageHandler +from handlers.messages_handler import WebSocketMessagesHandler from storage.storage_updaters import StorageUserUnsubscriber @pytest.fixture -def unsubscribe_handler(message_handler: WebSocketMessageHandler, ws_subscribed): +def unsubscribe_handler(message_handler: WebSocketMessagesHandler, ws_subscribed): return lambda unsubscribe_message: message_handler.handle_unsubscribe_message(ws_subscribed, unsubscribe_message)