Change test to use pytest

This commit is contained in:
Joseph Schorr 2017-07-14 16:49:44 +03:00
parent e7fec9dd20
commit be49dda756

View file

@ -1,20 +1,21 @@
import pytest
from notifications.models_interface import Repository from notifications.models_interface import Repository
from notifications.notificationevent import NotificationEvent from notifications.notificationevent import NotificationEvent
from test.fixtures import * from test.fixtures import *
def test_all_notifications(initialized_db): @pytest.mark.parametrize('event_name', NotificationEvent.event_names())
for subc in NotificationEvent.__subclasses__(): def test_build_notification(event_name, initialized_db):
if subc.event_name() is not None: # Create the notification event.
# Create the notification event. found = NotificationEvent.get_event(event_name)
found = NotificationEvent.get_event(subc.event_name()) sample_data = found.get_sample_data(Repository('foo', 'bar'), {'level': 'low'})
sample_data = found.get_sample_data(Repository('foo', 'bar'), {'level': 'low'})
# Make sure all calls succeed. # Make sure all calls succeed.
notification_data = { notification_data = {
'performer_data': {}, 'performer_data': {},
} }
found.get_level(sample_data, notification_data) found.get_level(sample_data, notification_data)
found.get_summary(sample_data, notification_data) found.get_summary(sample_data, notification_data)
found.get_message(sample_data, notification_data) found.get_message(sample_data, notification_data)