Change notificationworker to use a data interface

This commit is contained in:
Joseph Schorr 2017-07-12 15:50:47 +03:00
parent 8ec198228c
commit b6f1782642
10 changed files with 149 additions and 56 deletions

View file

@ -1,24 +1,15 @@
from data import model
from workers.notificationworker.notificationworker import NotificationWorker
from test.fixtures import *
from workers.notificationworker.models_pre_oci import pre_oci_model as model
def test_basic_notification(initialized_db):
# Ensure the public user doesn't have any notifications.
target_user = model.user.get_user('public')
assert len(list(model.notification.list_notifications(target_user))) == 0
assert not model.user_has_local_notifications('public')
# Add a basic build notification.
repo = model.repository.get_repository('devtable', 'simple')
method_data = {
'target': {
'kind': 'user',
'name': 'public',
}
}
notification = model.notification.create_repo_notification(repo, 'build_success',
'quay_notification', method_data, {})
notification_uuid = notification.uuid
notification_uuid = model.create_notification_for_testing('public')
event_data = {}
# Fire off the queue processing.
@ -29,4 +20,4 @@ def test_basic_notification(initialized_db):
})
# Ensure the notification was handled.
assert len(list(model.notification.list_notifications(target_user))) == 1
assert model.user_has_local_notifications('public')