feat(postbox): schedule lifecycle notification reconciliation
This commit is contained in:
@@ -25,6 +25,16 @@ class _RoutingProvider:
|
||||
del session, tenant_id, limit
|
||||
return {"selected": 0}
|
||||
|
||||
def reconcile_notification_lifecycle(
|
||||
self,
|
||||
session,
|
||||
*,
|
||||
tenant_id=None,
|
||||
limit=50,
|
||||
):
|
||||
del session, tenant_id, limit
|
||||
return {"scanned": 0}
|
||||
|
||||
|
||||
class PostboxRoutingWorkerTests(unittest.TestCase):
|
||||
def test_contract_is_runtime_checkable_and_resolved(self) -> None:
|
||||
@@ -59,6 +69,13 @@ class PostboxRoutingWorkerTests(unittest.TestCase):
|
||||
"selected": 1,
|
||||
"delivered": 1,
|
||||
}
|
||||
provider.reconcile_notification_lifecycle.return_value = {
|
||||
"scanned": 2,
|
||||
"changed": 1,
|
||||
"events": 2,
|
||||
"notifications": 1,
|
||||
"notification_failures": 0,
|
||||
}
|
||||
|
||||
with (
|
||||
patch(
|
||||
@@ -81,8 +98,15 @@ class PostboxRoutingWorkerTests(unittest.TestCase):
|
||||
tenant_id="tenant-1",
|
||||
limit=25,
|
||||
)
|
||||
provider.reconcile_notification_lifecycle.assert_called_once_with(
|
||||
session,
|
||||
tenant_id="tenant-1",
|
||||
limit=25,
|
||||
)
|
||||
session.commit.assert_called_once_with()
|
||||
self.assertEqual(1, result["delivered"])
|
||||
self.assertEqual(2, result["lifecycle_scanned"])
|
||||
self.assertEqual(1, result["lifecycle_notifications"])
|
||||
|
||||
def test_route_and_periodic_recovery_are_registered(self) -> None:
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user