(
self,
queue: str,
mock: MagicMock,
)
| 319 | |
| 320 | @pytest.mark.asyncio() |
| 321 | async def test_publisher_object( |
| 322 | self, |
| 323 | queue: str, |
| 324 | mock: MagicMock, |
| 325 | ) -> None: |
| 326 | event = asyncio.Event() |
| 327 | |
| 328 | pub_broker = self.get_broker(apply_types=True) |
| 329 | |
| 330 | publisher = pub_broker.publisher(queue + "resp") |
| 331 | |
| 332 | args, kwargs = self.get_subscriber_params(queue) |
| 333 | |
| 334 | @publisher |
| 335 | @pub_broker.subscriber(*args, **kwargs) |
| 336 | async def m() -> str: |
| 337 | return "" |
| 338 | |
| 339 | args, kwargs = self.get_subscriber_params(queue + "resp") |
| 340 | |
| 341 | @pub_broker.subscriber(*args, **kwargs) |
| 342 | async def resp(msg) -> None: |
| 343 | event.set() |
| 344 | mock(msg) |
| 345 | |
| 346 | async with self.patch_broker(pub_broker) as br: |
| 347 | await br.start() |
| 348 | await asyncio.wait( |
| 349 | ( |
| 350 | asyncio.create_task(br.publish("", queue)), |
| 351 | asyncio.create_task(event.wait()), |
| 352 | ), |
| 353 | timeout=self.timeout, |
| 354 | ) |
| 355 | |
| 356 | mock.assert_called_once_with("") |
| 357 | |
| 358 | @pytest.mark.asyncio() |
| 359 | async def test_publish_manual( |
nothing calls this directly
no test coverage detected