From fc99d966afa4912bfbbd9925632763bb9d83ef90 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin <markmc@redhat.com> Date: Mon, 24 Jun 2013 12:39:52 +0100 Subject: [PATCH] Make test notifier useful We need a way to query what notifications were sent to the test notifier and later clear out that list. --- oslo/messaging/notify/_impl_test.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/oslo/messaging/notify/_impl_test.py b/oslo/messaging/notify/_impl_test.py index 79e883e8e..10d69e607 100644 --- a/oslo/messaging/notify/_impl_test.py +++ b/oslo/messaging/notify/_impl_test.py @@ -17,14 +17,18 @@ from oslo.messaging.notify import notifier +NOTIFICATIONS = [] + + +def reset(): + "Clear out the list of recorded notifications." + global NOTIFICATIONS + NOTIFICATIONS = [] + class TestDriver(notifier._Driver): "Store notifications in memory for test verification." - def __init__(self, conf, **kwargs): - super(TestDriver, self).__init__(conf, **kwargs) - self.notifications = [] - def notify(self, ctxt, message, priority): - self.notifications.append(message) + NOTIFICATIONS.append((ctxt, message, priority))