(self, subtests)
| 353 | assert c._restore_prefetch_count_after_connection_restart(None) is None |
| 354 | |
| 355 | def test_create_task_handler(self, subtests): |
| 356 | c = self.get_consumer() |
| 357 | c.qos = MagicMock() |
| 358 | c.qos.value = 1 |
| 359 | c._maximum_prefetch_restored = False |
| 360 | |
| 361 | sig = self.add.s(2, 2) |
| 362 | message = self.task_message_from_sig(self.app, sig) |
| 363 | |
| 364 | def raise_exception(*args, **kwargs): |
| 365 | raise KeyError('Foo') |
| 366 | |
| 367 | def strategy(_, __, ack_log_error_promise, ___, ____): |
| 368 | ack_log_error_promise() |
| 369 | |
| 370 | c.strategies[sig.task] = strategy |
| 371 | c.call_soon_ack = raise_exception |
| 372 | on_task_received = c.create_task_handler() |
| 373 | on_task_received(message) |
| 374 | |
| 375 | with subtests.test("initial prefetch count is never 0"): |
| 376 | assert c.initial_prefetch_count != 0 |
| 377 | |
| 378 | with subtests.test("initial prefetch count is 2"): |
| 379 | assert c.initial_prefetch_count == 2 |
| 380 | |
| 381 | with subtests.test("maximum prefetch is reached"): |
| 382 | assert c._maximum_prefetch_restored is True |
| 383 | |
| 384 | def test_flush_events(self): |
| 385 | c = self.get_consumer() |
nothing calls this directly
no test coverage detected