Skip to content

Commit

Permalink
Remove message bus dependency (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed Apr 26, 2024
1 parent 1e9149c commit 6889fc1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/messaging/test_stomptemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from blueapi.config import StompConfig
from blueapi.messaging import MessageContext, MessagingTemplate, StompMessagingTemplate
from blueapi.service.handler import get_handler, setup_handler, teardown_handler

_TIMEOUT: float = 10.0
_COUNT = itertools.count()
Expand All @@ -28,13 +29,16 @@ def test_stomp_configs(self) -> Iterable[StompConfig]:
@pytest.fixture(params=StompTestingSettings().test_stomp_configs())
def disconnected_template(request: pytest.FixtureRequest) -> MessagingTemplate:
stomp_config = request.param
return StompMessagingTemplate.autoconfigured(stomp_config)
template = StompMessagingTemplate.autoconfigured(stomp_config)
assert template is not None
return template


@pytest.fixture(params=StompTestingSettings().test_stomp_configs())
def template(request: pytest.FixtureRequest) -> Iterable[MessagingTemplate]:
stomp_config = request.param
template = StompMessagingTemplate.autoconfigured(stomp_config)
assert template is not None
template.connect()
yield template
template.disconnect()
Expand Down Expand Up @@ -218,3 +222,10 @@ def server(ctx: MessageContext, message: str) -> None:
template.send(reply_queue, "ack", correlation_id=ctx.correlation_id)

template.subscribe(destination, server)


def test_messaging_template_can_be_set_with_none():
setup_handler(None)
teardown_handler()
with pytest.raises(ValueError):
get_handler()

0 comments on commit 6889fc1

Please sign in to comment.