From 2efaee6aeff65fb1e2fbd04aefecde0d680c8911 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 3 Oct 2016 15:17:05 -0400 Subject: [PATCH] Fix all of the sample notification calls. --- endpoints/notificationevent.py | 40 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/endpoints/notificationevent.py b/endpoints/notificationevent.py index b550d76b0..2828f86ad 100644 --- a/endpoints/notificationevent.py +++ b/endpoints/notificationevent.py @@ -92,7 +92,13 @@ class RepoPushEvent(NotificationEvent): return 'Repository %s updated' % (event_data['repository']) def get_sample_data(self, notification): - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'updated_tags': {'latest': 'someimageid', 'foo': 'anotherimage'}, 'pruned_image_count': 3 }) @@ -196,7 +202,13 @@ class BuildQueueEvent(BaseBuildEvent): def get_sample_data(self, notification): build_uuid = 'fake-build-id' - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'is_manual': False, 'build_id': build_uuid, 'build_name': 'some-fake-build', @@ -235,7 +247,13 @@ class BuildStartEvent(BaseBuildEvent): def get_sample_data(self, notification): build_uuid = 'fake-build-id' - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'build_id': build_uuid, 'build_name': 'some-fake-build', 'docker_tags': ['latest', 'foo', 'bar'], @@ -263,7 +281,13 @@ class BuildSuccessEvent(BaseBuildEvent): def get_sample_data(self, notification): build_uuid = 'fake-build-id' - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'build_id': build_uuid, 'build_name': 'some-fake-build', 'docker_tags': ['latest', 'foo', 'bar'], @@ -292,7 +316,13 @@ class BuildFailureEvent(BaseBuildEvent): def get_sample_data(self, notification): build_uuid = 'fake-build-id' - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'build_id': build_uuid, 'build_name': 'some-fake-build', 'docker_tags': ['latest', 'foo', 'bar'],