Switch to side-by-side view

--- a/Allura/allura/tests/model/test_notification.py
+++ b/Allura/allura/tests/model/test_notification.py
@@ -1,4 +1,5 @@
 import unittest
+from datetime import timedelta
 
 from pylons import g, c
 
@@ -15,8 +16,11 @@
         helpers.setup_basic_test()
         helpers.setup_global_objects()
         _clear_subscriptions()
+        _clear_notifications()
         ThreadLocalORMSession.flush_all()
         ThreadLocalORMSession.close_all()
+        g.mock_amq.clear()
+        M.notification.MAILBOX_QUIESCENT=None # disable message combining
 
     def test_subscribe_unsubscribe(self):
         M.Mailbox.subscribe(type='direct')
@@ -46,9 +50,12 @@
         helpers.setup_global_objects()
         g.set_app('wiki')
         _clear_subscriptions()
+        _clear_notifications()
         ThreadLocalORMSession.flush_all()
         ThreadLocalORMSession.close_all()
         self.pg = WM.Page.query.get()
+        g.mock_amq.clear()
+        M.notification.MAILBOX_QUIESCENT=None # disable message combining
 
     def test_post_notification(self):
         self._post_notification()
@@ -103,10 +110,13 @@
         helpers.setup_global_objects()
         g.set_app('wiki')
         _clear_subscriptions()
+        _clear_notifications()
         ThreadLocalORMSession.flush_all()
         ThreadLocalORMSession.close_all()
         self.pg = WM.Page.query.get()
         g.mock_amq.setup_handlers()
+        g.mock_amq.clear()
+        M.notification.MAILBOX_QUIESCENT=None # disable message combining
 
     def test_direct_sub(self):
         self._subscribe()
@@ -138,6 +148,14 @@
         assert len(g.mock_amq.exchanges['audit'][0]['message']['text']) < 1024
 
     def test_message(self):
+        self._test_message()
+        self.setUp()
+        self._test_message()
+        self.setUp()
+        M.notification.MAILBOX_QUIESCENT=timedelta(minutes=1)
+        self.assertRaises(AssertionError, self._test_message)
+
+    def _test_message(self):
         self._subscribe()
         thd = M.Thread.query.get(artifact_reference=self.pg.dump_ref())
         p = thd.post('This is a very cool message')
@@ -145,7 +163,8 @@
         M.Mailbox.fire_ready()
         ThreadLocalORMSession.flush_all()
         ThreadLocalORMSession.close_all()
-        assert len(g.mock_amq.exchanges['audit']) == 1
+        num_msgs = len(g.mock_amq.exchanges['audit'])
+        assert num_msgs == 1, num_msgs
         msg = g.mock_amq.exchanges['audit'][0]['message']
         assert 'Home@wiki.test.p' in msg['reply_to']
         assert 'Test Admin' in msg['from']
@@ -166,4 +185,6 @@
 def _clear_subscriptions():
         M.Mailbox.query.remove({})
 
+def _clear_notifications():
+        M.Notification.query.remove({})