Change get_sample_data API to not require the custom notification tuple
This commit is contained in:
parent
e7dbc4ee91
commit
e7fec9dd20
3 changed files with 21 additions and 31 deletions
|
@ -8,10 +8,10 @@ from endpoints.api import (RepositoryParamResource, nickname, resource, require_
|
|||
path_param, disallow_for_app_repositories)
|
||||
from endpoints.exception import NotFound
|
||||
from notifications import build_notification_data
|
||||
from notifications.models_interface import Repository
|
||||
from notifications.notificationevent import NotificationEvent
|
||||
from notifications.notificationmethod import (NotificationMethod,
|
||||
CannotValidateNotificationMethodException)
|
||||
from workers.notificationworker.models_pre_oci import notification
|
||||
from endpoints.api.repositorynotification_models_pre_oci import pre_oci_model as model
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -153,6 +153,8 @@ class TestRepositoryNotification(RepositoryParamResource):
|
|||
def post(self, namespace_name, repository_name, uuid):
|
||||
""" Queues a test notification for this repository. """
|
||||
test_note = model.queue_test_notification(uuid)
|
||||
event_info = NotificationEvent.get_event(test_note.event_name)
|
||||
sample_data = event_info.get_sample_data(Repository(namespace, repository), event_config)
|
||||
|
||||
if not test_note:
|
||||
raise InvalidRequest("No repository notification found for: %s, %s, %s" % (namespace_name, repository_name, uuid))
|
||||
|
|
Reference in a new issue