[CalendarServer-changes] [11369] CalendarServer/trunk/twext/python/test/test_log.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 14 15:26:48 PDT 2013


Revision: 11369
          http://trac.calendarserver.org//changeset/11369
Author:   wsanchez at apple.com
Date:     2013-06-14 15:26:48 -0700 (Fri, 14 Jun 2013)
Log Message:
-----------
Add test_call

Modified Paths:
--------------
    CalendarServer/trunk/twext/python/test/test_log.py

Modified: CalendarServer/trunk/twext/python/test/test_log.py
===================================================================
--- CalendarServer/trunk/twext/python/test/test_log.py	2013-06-14 22:17:21 UTC (rev 11368)
+++ CalendarServer/trunk/twext/python/test/test_log.py	2013-06-14 22:26:48 UTC (rev 11369)
@@ -476,7 +476,7 @@
         """
         L{FilteringLogObserver} is an L{ILogObserver}.
         """
-        observer = FilteringLogObserver(lambda e: PredicateResult.maybe, ())
+        observer = FilteringLogObserver(lambda e: None, ())
         try:
             verifyObject(ILogObserver, observer)
         except BrokenMethodImplementation as e:
@@ -539,7 +539,21 @@
         self.assertEquals(self.filterWith("twoPlus", "twoMinus", "no"), [0, 1, 2, 3])
 
 
+    def test_call(self):
+        e = dict(obj=object())
 
+        def callWithPredicateResult(result):
+            seen = []
+            observer = FilteringLogObserver(lambda e: seen.append(e), (lambda e: result,))
+            observer(e)
+            return seen
+
+        self.assertIn(e, callWithPredicateResult(PredicateResult.yes))
+        self.assertIn(e, callWithPredicateResult(PredicateResult.maybe))
+        self.assertNotIn(e, callWithPredicateResult(PredicateResult.no))
+
+
+
 class LegacyLoggerTests(SetUpTearDown, TestCase):
     """
     Tests for L{LegacyLogger}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130614/e39c5bfc/attachment.html>


More information about the calendarserver-changes mailing list