2013-05-17 18:48:55 +01:00
|
|
|
|
|
|
|
# Copyright 2011 OpenStack Foundation.
|
|
|
|
# All Rights Reserved.
|
|
|
|
# Copyright 2013 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
2015-01-02 14:24:57 -05:00
|
|
|
from oslo_messaging.notify import notifier
|
2013-05-17 18:48:55 +01:00
|
|
|
|
2013-06-24 12:39:52 +01:00
|
|
|
NOTIFICATIONS = []
|
|
|
|
|
|
|
|
|
|
|
|
def reset():
|
|
|
|
"Clear out the list of recorded notifications."
|
|
|
|
global NOTIFICATIONS
|
|
|
|
NOTIFICATIONS = []
|
|
|
|
|
2013-05-17 18:48:55 +01:00
|
|
|
|
2015-09-24 11:20:35 -04:00
|
|
|
class TestDriver(notifier.Driver):
|
2013-05-17 18:48:55 +01:00
|
|
|
|
2013-06-23 13:21:42 +01:00
|
|
|
"Store notifications in memory for test verification."
|
|
|
|
|
2014-05-06 13:47:12 +02:00
|
|
|
def notify(self, ctxt, message, priority, retry):
|
|
|
|
NOTIFICATIONS.append((ctxt, message, priority, retry))
|