summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2011-03-03 11:56:21 -0600
committerCerberus <matt.dietz@rackspace.com>2011-03-03 11:56:21 -0600
commit63d799a5ac6172b73708a183f3d952a2c8b53c2b (patch)
tree39c453193647bd598b28940bbf88cbc484d70f4e /nova/tests
parent98e665f870c20d81db13bb9e5402a7b187dfe539 (diff)
Basic notifications drivers and tests
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_notifier.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/nova/tests/test_notifier.py b/nova/tests/test_notifier.py
new file mode 100644
index 000000000..831ae8bf3
--- /dev/null
+++ b/nova/tests/test_notifier.py
@@ -0,0 +1,41 @@
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# 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.
+
+from nova import notifier
+from nova import test
+
+import stubout
+
+class NotifierTestCase(test.TestCase):
+ """Test case for notifications"""
+ def setUp(self):
+ super(NotifierTestCase, self).setUp()
+ self.stubs = stubout.StubOutForTesting()
+
+ def tearDown(self):
+ self.stubs.UnsetAll()
+ super(NotifierTestCase, self).tearDown()
+
+ def test_send_notification(self):
+ self.notify_called = False
+ def mock_notify(self, model):
+ self.notify_called = True
+
+ self.stubs.set(nova.notifier.no_op_notifier.NoopNotifier, 'notify',
+ mock_notify)
+
+ model = dict(x=1, y=2)
+ notifier.notify(model)
+ self.assertEqual(True, self.notify_called)