[CalendarServer-changes] [13561] CalendarServer/trunk/txdav/dps/test/test_json.py

source_changes at macosforge.org source_changes at macosforge.org
Thu May 29 12:06:07 PDT 2014


Revision: 13561
          http://trac.calendarserver.org//changeset/13561
Author:   wsanchez at apple.com
Date:     2014-05-29 12:06:07 -0700 (Thu, 29 May 2014)
Log Message:
-----------
Add test_compoundExpressionAsJSON_operands

Modified Paths:
--------------
    CalendarServer/trunk/txdav/dps/test/test_json.py

Modified: CalendarServer/trunk/txdav/dps/test/test_json.py
===================================================================
--- CalendarServer/trunk/txdav/dps/test/test_json.py	2014-05-29 19:02:33 UTC (rev 13560)
+++ CalendarServer/trunk/txdav/dps/test/test_json.py	2014-05-29 19:06:07 UTC (rev 13561)
@@ -140,9 +140,29 @@
             json = compoundExpressionAsJSON(expression)
 
             expected = {
-                'type': 'CompoundExpression',
-                'expressions': subExpressionsText,
-                'operand': 'AND',
+                "type": "CompoundExpression",
+                "expressions": subExpressionsText,
+                "operand": "AND",
             }
 
             self.assertEquals(json, expected)
+
+
+    def test_compoundExpressionAsJSON_operands(self):
+        """
+        L{compoundExpressionAsJSON} with different operands.
+        """
+        for operand, operandText in (
+            (Operand.AND, b"AND"),
+            (Operand.OR, b"OR"),
+        ):
+            expression = CompoundExpression((), operand)
+            json = compoundExpressionAsJSON(expression)
+
+            expected = {
+                "type": "CompoundExpression",
+                "expressions": [],
+                "operand": operandText,
+            }
+
+            self.assertEquals(json, expected)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140529/db200662/attachment-0001.html>


More information about the calendarserver-changes mailing list