31 lines
928 B
Python
31 lines
928 B
Python
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',
|
|
},
|
|
})
|
|
|
|
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)
|
|
|
|
# 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)
|