Change get_sample_data API to not require the custom notification tuple

This commit is contained in:
Joseph Schorr 2017-07-14 16:48:31 +03:00
parent e7dbc4ee91
commit e7fec9dd20
3 changed files with 21 additions and 31 deletions

View file

@ -1,25 +1,14 @@
from notifications.models_interface import Repository
from notifications.notificationevent import NotificationEvent
from util.morecollections import AttrDict
from test.fixtures import *
def test_all_notifications(app):
# Create a test notification.
test_notification = AttrDict({
'repository': AttrDict({
'namespace_name': AttrDict(dict(username='foo')),
'name': 'bar',
}),
'event_config_dict': {
'level': 'low',
},
})
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(test_notification)
sample_data = found.get_sample_data(Repository('foo', 'bar'), {'level': 'low'})
# Make sure all calls succeed.
notification_data = {