[CalendarServer-changes] [10614] CalendarServer/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Thu Jan 31 15:43:31 PST 2013


Revision: 10614
          http://trac.calendarserver.org//changeset/10614
Author:   wsanchez at apple.com
Date:     2013-01-31 15:43:31 -0800 (Thu, 31 Jan 2013)
Log Message:
-----------
Typo: recordFromQuery -> recordsFromQuery
Add tests for base recordsFromQuery()

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

Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py	2013-01-31 22:17:24 UTC (rev 10613)
+++ CalendarServer/trunk/twext/who/directory.py	2013-01-31 23:43:31 UTC (rev 10614)
@@ -60,8 +60,10 @@
         return self.RecordTypeClass.iterconstants()
 
 
-    def recordFromQuery(self, expressions, operand=Operand.AND):
-        raise QueryNotSupportedError("")
+    def recordsFromQuery(self, expressions, operand=Operand.AND):
+        for expression in expressions:
+            raise QueryNotSupportedError("")
+        return ()
 
 
 

Modified: CalendarServer/trunk/twext/who/idirectory.py
===================================================================
--- CalendarServer/trunk/twext/who/idirectory.py	2013-01-31 22:17:24 UTC (rev 10613)
+++ CalendarServer/trunk/twext/who/idirectory.py	2013-01-31 23:43:31 UTC (rev 10614)
@@ -165,7 +165,7 @@
             C{("users", "groups", "resources")}.
         """
 
-    def recordFromQuery(expressions, operand=Operand.AND):
+    def recordsFromQuery(expressions, operand=Operand.AND):
         """
         @return: a deferred iterable of matching L{IDirectoryRecord}s.
         @raises: L{QueryNotSupportedError} is the query is not

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-01-31 22:17:24 UTC (rev 10613)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-01-31 23:43:31 UTC (rev 10614)
@@ -22,8 +22,9 @@
 
 from twisted.trial import unittest
 
+from twext.who.idirectory import QueryNotSupportedError
+from twext.who.idirectory import RecordType, FieldName
 from twext.who.idirectory import IDirectoryService, IDirectoryRecord
-from twext.who.idirectory import RecordType, FieldName
 from twext.who.directory import DirectoryService, DirectoryRecord
 
 
@@ -57,10 +58,15 @@
             set(service.RecordTypeClass.iterconstants())
         )
 
-    def test_recordFromQuery(self):
-        raise NotImplementedError()
+    def test_recordsFromQueryNone(self):
+        service = self._testService()
+        records = service.recordsFromQuery(())
+        for record in records:
+            self.failTest("No records expected")
 
-    test_recordFromQuery.todo = "Not implemented."
+    def test_recordsFromQueryBogus(self):
+        service = self._testService()
+        self.assertRaises(QueryNotSupportedError, service.recordsFromQuery, (object(),))
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130131/9b1bcdb1/attachment.html>


More information about the calendarserver-changes mailing list