Merge pull request #972 from alphagov/imdad-fix-test-can-cause-error

Fix test that doesn't account for notifications being created in a di…
This commit is contained in:
Imdad Ahad
2017-05-23 13:13:59 +01:00
committed by GitHub

View File

@@ -106,7 +106,9 @@ def test_send_notification_to_service_users_sends_to_active_users_only(
send_notification_to_service_users(service_id=service.id, template_id=template.id)
notifications = Notification.query.all()
notifications_recipients = [notification.to for notification in notifications]
assert Notification.query.count() == 2
assert pending_user.email_address not in [n.to for n in notifications]
assert pending_user.email_address not in notifications_recipients
assert first_active_user.email_address in notifications_recipients
assert second_active_user.email_address in notifications_recipients