diff --git a/lemur/notifications/messaging.py b/lemur/notifications/messaging.py index 6cd32755..b287fefd 100644 --- a/lemur/notifications/messaging.py +++ b/lemur/notifications/messaging.py @@ -131,10 +131,10 @@ def send_expiration_notifications(exclude): else: failure += 1 - if send_notification('expiration', security_data, security_email, notification): - success += 1 - else: - failure += 1 + if send_notification('expiration', security_data, security_email, notification): + success += 1 + else: + failure += 1 return success, failure diff --git a/lemur/tests/test_messaging.py b/lemur/tests/test_messaging.py index e846fc73..fc0e62da 100644 --- a/lemur/tests/test_messaging.py +++ b/lemur/tests/test_messaging.py @@ -74,6 +74,15 @@ def test_send_expiration_notification(certificate, notification, notification_pl assert send_expiration_notifications([]) == (2, 0) +@mock_ses +def test_send_expiration_notification_with_no_notifications(certificate, notification, notification_plugin): + from lemur.notifications.messaging import send_expiration_notifications + + delta = certificate.not_after - timedelta(days=10) + with freeze_time(delta.datetime): + assert send_expiration_notifications([]) == (0, 0) + + @mock_ses def test_send_rotation_notification(notification_plugin, certificate): from lemur.notifications.messaging import send_rotation_notification