[Zope3-checkins] CVS: Zope3/src/zope/app/observable - tests.py:1.1.2.3

Nathan Yergler nathan at yergler.net
Tue Mar 30 08:30:13 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/observable
In directory cvs.zope.org:/tmp/cvs-serv26157/src/zope/app/observable

Modified Files:
      Tag: observable-branch
	tests.py 
Log Message:


Added tests for ObservableAdapter's unsubscribe method; improved test for subscribe method.


=== Zope3/src/zope/app/observable/tests.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/observable/tests.py:1.1.2.2	Mon Mar 29 16:02:57 2004
+++ Zope3/src/zope/app/observable/tests.py	Tue Mar 30 08:30:12 2004
@@ -56,6 +56,29 @@
     Make sure an ObjectAdapterRegistry was created
     >>> obj[key] is not None
     True
+
+    Make sure the registry contains a subscription for the correct event
+    >>> IObjectAddedEvent in obj[key].adapters
+    True
+
+    """
+
+def test_unsubscribe():
+    """
+    First create an annotatable object and an adapter
+    >>> obj = DummyAnnotationsClass()
+    >>> adapter = ObservableAdapter(obj)
+
+    Make a subscriber and make a faux subscription
+    >>> subscriber = DummySubscriber()
+    >>> adapter.subscribe([IObjectAddedEvent], ISubscriber, subscriber)
+
+    Now unsubscribe from the registry
+    >>> adapter.unsubscribe([IObjectAddedEvent], ISubscriber, subscriber)
+
+    There should be no subscribers for IObjectAddedEvent after unsubscription.
+    >>> obj[key].adapters[IObjectAddedEvent]
+    {}
     """
 
 def test_notify():




More information about the Zope3-Checkins mailing list