Build 060.21: integrate acquisition runtime protocols
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from src.market_data.acquisition.runtime.websocket_protocol import (
|
||||
AcquisitionRuntimeCommand,
|
||||
AcquisitionRuntimeCommandDispatcherProtocol,
|
||||
AcquisitionRuntimeEvent,
|
||||
AcquisitionRuntimeEventPublisherProtocol,
|
||||
WebSocketSessionProtocol,
|
||||
WebSocketSubscriptionManagerProtocol,
|
||||
WebSocketTransportProtocol,
|
||||
@@ -43,6 +47,22 @@ class FakeWebSocketSubscriptionManager:
|
||||
return None
|
||||
|
||||
|
||||
class FakeRuntimeCommandDispatcher:
|
||||
async def dispatch(
|
||||
self,
|
||||
command: AcquisitionRuntimeCommand,
|
||||
) -> None:
|
||||
return None
|
||||
|
||||
|
||||
class FakeRuntimeEventPublisher:
|
||||
async def publish(
|
||||
self,
|
||||
event: AcquisitionRuntimeEvent,
|
||||
) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def test_transport_implementation_satisfies_protocol() -> None:
|
||||
assert isinstance(FakeWebSocketTransport(), WebSocketTransportProtocol)
|
||||
|
||||
@@ -58,9 +78,43 @@ def test_subscription_manager_implementation_satisfies_protocol() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_command_dispatcher_implementation_satisfies_protocol() -> None:
|
||||
assert isinstance(
|
||||
FakeRuntimeCommandDispatcher(),
|
||||
AcquisitionRuntimeCommandDispatcherProtocol,
|
||||
)
|
||||
|
||||
|
||||
def test_event_publisher_implementation_satisfies_protocol() -> None:
|
||||
assert isinstance(
|
||||
FakeRuntimeEventPublisher(),
|
||||
AcquisitionRuntimeEventPublisherProtocol,
|
||||
)
|
||||
|
||||
|
||||
def test_incomplete_transport_does_not_satisfy_protocol() -> None:
|
||||
class IncompleteTransport:
|
||||
async def connect(self) -> None:
|
||||
return None
|
||||
|
||||
assert not isinstance(IncompleteTransport(), WebSocketTransportProtocol)
|
||||
assert not isinstance(IncompleteTransport(), WebSocketTransportProtocol)
|
||||
|
||||
|
||||
def test_incomplete_command_dispatcher_does_not_satisfy_protocol() -> None:
|
||||
class IncompleteCommandDispatcher:
|
||||
pass
|
||||
|
||||
assert not isinstance(
|
||||
IncompleteCommandDispatcher(),
|
||||
AcquisitionRuntimeCommandDispatcherProtocol,
|
||||
)
|
||||
|
||||
|
||||
def test_incomplete_event_publisher_does_not_satisfy_protocol() -> None:
|
||||
class IncompleteEventPublisher:
|
||||
pass
|
||||
|
||||
assert not isinstance(
|
||||
IncompleteEventPublisher(),
|
||||
AcquisitionRuntimeEventPublisherProtocol,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user