[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Caching/RAMCache/tests - test_RAMCache.py:1.7

Albertas Agejevas alga@codeworks.lt
Fri, 6 Dec 2002 04:54:15 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Caching/RAMCache/tests
In directory cvs.zope.org:/tmp/cvs-serv436/tests

Modified Files:
	test_RAMCache.py 
Log Message:
Regard only ObjectModification events

=== Zope3/lib/python/Zope/App/Caching/RAMCache/tests/test_RAMCache.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/Caching/RAMCache/tests/test_RAMCache.py:1.6	Tue Dec  3 03:45:46 2002
+++ Zope3/lib/python/Zope/App/Caching/RAMCache/tests/test_RAMCache.py	Fri Dec  6 04:54:14 2002
@@ -202,22 +202,29 @@
 
     def test_notify(self):
         from Zope.App.Caching.RAMCache.RAMCache import RAMCache
-        from Zope.Event.ObjectEvent import ObjectModifiedEvent
+        from Zope.Event.ObjectEvent import ObjectModifiedEvent, ObjectEvent
+        from Zope.Event.IEvent import IEvent
 
-        location = ('aaa',)
+        class DummyEvent:
+            __implements__ = IEvent
 
+        location = ('aaa',)
+        ob = Locatable(path=location)
         keywords = {"answer": 42}
         value = "true"
         c = RAMCache()
         key = RAMCache._buildKey(keywords)
         c._getStorage().setEntry(location, key, value)
+        
+        c.notify(DummyEvent())
+        self.assertEquals(c._getStorage().getEntry(location, key),
+                          value, "doesn't ignore uninteresting events")
+
+        c.notify(ObjectEvent(ob, location))
+        self.assertEquals(c._getStorage().getEntry(location, key),
+                          value, "doesn't ignore uninteresting events")
 
-
-        ob = Locatable(path=location)
-        event = ObjectModifiedEvent(ob, location)
-
-        c.notify(event)
-
+        c.notify(ObjectModifiedEvent(ob, location))
         self.assertRaises(KeyError, c._getStorage().getEntry, location, key)