Projet

Général

Profil

0005-lingo-fix-untested-path-in-notify_new_remote_invoice.patch

Benjamin Dauvergne, 24 mars 2018 02:20

Télécharger (1,69 ko)

Voir les différences:

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(-)
combo/apps/lingo/models.py
241 241
        notification_reminder_id = self.get_notification_reminder_id(invoice)
242 242
        if pay_limit_date < now:
243 243
            # invoice is out of date
244
            Notification.forget(user, notification_id)
245
            Notification.forget(user, notification_reminder_id)
244
            Notification.objects.find(user, notification_id).forget()
245
            Notification.objects.find(user, notification_reminder_id).forget()
246 246
        else:
247 247
            # invoice can be paid
248 248
            if pay_limit_date > now + remind_delta:
tests/test_notification.py
350 350
    regie.notify_new_remote_invoices()
351 351
    assert Notification.objects.count() == 4
352 352

  
353
    freezer.move_to(invoice_now + timedelta(days=21))
354
    regie.notify_new_remote_invoices()
355
    assert Notification.objects.visible().count() == 0
356

  
353 357

  
354 358
def test_notification_never_expire(app, freezer, rf, john_doe):
355 359
    start = freezer()
356
-