From be49dda75620cec38211de34c0899de72773f45c Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 14 Jul 2017 16:49:44 +0300 Subject: [PATCH] Change test to use pytest --- notifications/test/test_notificationevent.py | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/notifications/test/test_notificationevent.py b/notifications/test/test_notificationevent.py index a5f83648d..0ec01bf9c 100644 --- a/notifications/test/test_notificationevent.py +++ b/notifications/test/test_notificationevent.py @@ -1,20 +1,21 @@ +import pytest + from notifications.models_interface import Repository from notifications.notificationevent import NotificationEvent from test.fixtures import * -def test_all_notifications(initialized_db): - for subc in NotificationEvent.__subclasses__(): - if subc.event_name() is not None: - # Create the notification event. - found = NotificationEvent.get_event(subc.event_name()) - sample_data = found.get_sample_data(Repository('foo', 'bar'), {'level': 'low'}) +@pytest.mark.parametrize('event_name', NotificationEvent.event_names()) +def test_build_notification(event_name, initialized_db): + # Create the notification event. + found = NotificationEvent.get_event(event_name) + sample_data = found.get_sample_data(Repository('foo', 'bar'), {'level': 'low'}) - # Make sure all calls succeed. - notification_data = { - 'performer_data': {}, - } + # Make sure all calls succeed. + notification_data = { + 'performer_data': {}, + } - found.get_level(sample_data, notification_data) - found.get_summary(sample_data, notification_data) - found.get_message(sample_data, notification_data) + found.get_level(sample_data, notification_data) + found.get_summary(sample_data, notification_data) + found.get_message(sample_data, notification_data)