[CalendarServer-changes] [11920] CalendarServer/trunk/twext/who/test/test_directory.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:16:17 PDT 2014


Revision: 11920
          http://trac.calendarserver.org//changeset/11920
Author:   wsanchez at apple.com
Date:     2013-11-08 15:22:03 -0800 (Fri, 08 Nov 2013)
Log Message:
-----------
Test for unknown operand.

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/test/test_directory.py

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-08 23:00:30 UTC (rev 11919)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-08 23:22:03 UTC (rev 11920)
@@ -22,6 +22,7 @@
 
 from zope.interface.verify import verifyObject, BrokenMethodImplementation
 
+from twisted.python.constants import Names, NamedConstant
 from twisted.trial import unittest
 from twisted.trial.unittest import SkipTest
 from twisted.internet.defer import inlineCallbacks
@@ -296,6 +297,26 @@
         )
 
 
+    def test_recordsFromExpression_unknownOperand(self):
+        """
+        C{recordsFromExpression} fails with L{QueryNotSupportedError} when
+        given a L{CompoundExpression} with an unknown operand.
+        """
+        service = StubDirectoryService()
+
+        results = service.recordsFromExpression(
+            CompoundExpression(
+                (
+                    u"twistedmatrix.com",
+                    u"calendarserver.org",
+                ),
+                WackyOperand.WHUH
+            )
+        )
+
+        self.assertFailure(results, QueryNotSupportedError)
+
+
     def test_recordWithUID(self):
         service = self.service()
         self.assertFailure(
@@ -693,3 +714,10 @@
         return DirectoryService.recordsFromNonCompoundExpression(
             self, expression, records=records
         )
+
+
+class WackyOperand(Names):
+    """
+    Wacky operands.
+    """
+    WHUH = NamedConstant()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/06c6e3d3/attachment.html>


More information about the calendarserver-changes mailing list