changeset 25:73756a9e87a6

added to observer test
author Atul Varma <varmaa@toolness.com>
date Wed, 23 Dec 2009 22:51:41 -0800
parents e61a42133a33
children 057f6f0eac22
files test.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test.py	Wed Dec 23 22:46:59 2009 -0800
+++ b/test.py	Wed Dec 23 22:51:41 2009 -0800
@@ -121,15 +121,23 @@
 
     def test_observers_are_notified(self):
         notifications = []
+
         class Observer(object):
             def notify(self, info):
                 notifications.append(info)
+
         self.api.add_fake_bug(id='1034')
         self.search.add_observer(Observer())
+
         self.search.update()
         self.assertEqual(len(notifications), 1)
         self.assertEqual(notifications[0]['bug'], '1034')
 
+        # Ensure updating w/o state change doesn't trigger
+        # observers.
+        self.search.update()
+        self.assertEqual(len(notifications), 1)
+
 class ApiTests(_MongoTestCase):
     class FakeOpenUrl(object):
         def __init__(self):