From 2de480ecd01986e6d6c0ad503c27a5476ad14e4c Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 24 Mar 2018 02:18:47 +0100 Subject: [PATCH 5/5] lingo: fix untested path in notify_new_remote_invoices (#22732) --- combo/apps/lingo/models.py | 4 ++-- tests/test_notification.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index 9b53de7..3f312cb 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/lingo/models.py @@ -241,8 +241,8 @@ class Regie(models.Model): notification_reminder_id = self.get_notification_reminder_id(invoice) if pay_limit_date < now: # invoice is out of date - Notification.forget(user, notification_id) - Notification.forget(user, notification_reminder_id) + Notification.objects.find(user, notification_id).forget() + Notification.objects.find(user, notification_reminder_id).forget() else: # invoice can be paid if pay_limit_date > now + remind_delta: diff --git a/tests/test_notification.py b/tests/test_notification.py index 1e63929..f25d81d 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -350,6 +350,10 @@ def test_notify_remote_items(mock_get, app, john_doe, jane_doe, regie, freezer): regie.notify_new_remote_invoices() assert Notification.objects.count() == 4 + freezer.move_to(invoice_now + timedelta(days=21)) + regie.notify_new_remote_invoices() + assert Notification.objects.visible().count() == 0 + def test_notification_never_expire(app, freezer, rf, john_doe): start = freezer() -- 2.14.2