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

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


Revision: 12396
          http://trac.calendarserver.org//changeset/12396
Author:   wsanchez at apple.com
Date:     2014-01-18 12:09:06 -0800 (Sat, 18 Jan 2014)
Log Message:
-----------
Pull in DirectoryServiceQueryTestMixIn and mark tests as todo for now.

Modified Paths:
--------------
    twext/trunk/twext/who/ldap/_service.py
    twext/trunk/twext/who/ldap/test/test_service.py
    twext/trunk/twext/who/test/test_xml.py

Modified: twext/trunk/twext/who/ldap/_service.py
===================================================================
--- twext/trunk/twext/who/ldap/_service.py	2014-01-18 19:49:04 UTC (rev 12395)
+++ twext/trunk/twext/who/ldap/_service.py	2014-01-18 20:09:06 UTC (rev 12396)
@@ -25,7 +25,7 @@
 
 import ldap
 
-from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.internet.defer import succeed, inlineCallbacks, returnValue
 from twisted.internet.threads import deferToThread
 from twisted.cred.credentials import IUsernamePassword
 
@@ -432,7 +432,7 @@
 
     def recordsFromCompoundExpression(self, expression, records=None):
         if not expression.expressions:
-            return ()
+            return succeed(())
 
         queryString = ldapQueryStringFromCompoundExpression(
             expression,
@@ -447,8 +447,20 @@
     LDAP directory record.
     """
 
+    @inlineCallbacks
+    def members(self):
+        if self.recordType != self.service.recordType.group:
+            returnValue(())
 
+        raise NotImplementedError()
 
+
+    @inlineCallbacks
+    def groups(self):
+        raise NotImplementedError()
+
+
+
 def reverseDict(sourceName, source):
     new = {}
 

Modified: twext/trunk/twext/who/ldap/test/test_service.py
===================================================================
--- twext/trunk/twext/who/ldap/test/test_service.py	2014-01-18 19:49:04 UTC (rev 12395)
+++ twext/trunk/twext/who/ldap/test/test_service.py	2014-01-18 20:09:06 UTC (rev 12396)
@@ -41,10 +41,11 @@
 from ...test import test_directory
 from ...test.test_xml import (
     xmlService,
-    BaseTest as XMLBaseTest,
+    BaseTest as XMLBaseTest, QueryMixIn,
     DirectoryServiceConvenienceTestMixIn
     as BaseDirectoryServiceConvenienceTestMixIn,
-    DirectoryServiceRealmTestMixIn as BaseDirectoryServiceRealmTestMixIn,
+    DirectoryServiceRealmTestMixIn,
+    DirectoryServiceQueryTestMixIn as BaseDirectoryServiceQueryTestMixIn,
 )
 
 
@@ -54,6 +55,11 @@
 
 
 
+class TestService(DirectoryService, QueryMixIn):
+    pass
+
+
+
 class BaseTestCase(XMLBaseTest):
     """
     Tests for L{DirectoryService}.
@@ -84,7 +90,7 @@
 
 
     def service(self, **kwargs):
-        return DirectoryService(
+        return TestService(
             url=self.url,
             baseDN=self.baseDN,
             fieldNameToAttributesMap=TEST_FIELDNAME_MAP,
@@ -105,7 +111,174 @@
         )
 
 
+class DirectoryServiceQueryTestMixIn(BaseDirectoryServiceQueryTestMixIn):
+    def test_queryAnd(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryAnd(self)
 
+    test_queryAnd.todo = "?"
+
+
+    def test_queryAndNoneFirst(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryAndNoneFirst(self)
+
+    test_queryAndNoneFirst.todo = "?"
+
+
+    def test_queryAnd(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryAnd(self)
+
+    test_queryAnd.todo = "?"
+
+
+    def test_queryOr(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryOr(self)
+
+    test_queryOr.todo = "?"
+
+
+    def test_queryNot(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryNot(self)
+
+    test_queryNot.todo = "?"
+
+
+    def test_queryAnd(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryAnd(self)
+
+    test_queryAnd.todo = "?"
+
+
+    def test_queryNotNoIndex(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryNotNoIndex(self)
+
+    test_queryNotNoIndex.todo = "?"
+
+
+    def test_queryCaseInsensitive(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn.test_queryCaseInsensitive(self)
+        )
+
+    test_queryCaseInsensitive.todo = "?"
+
+
+    def test_queryCaseInsensitiveNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryCaseInsensitiveNoIndex(self)
+        )
+
+    test_queryCaseInsensitiveNoIndex.todo = "?"
+
+
+    def test_queryStartsWith(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn.test_queryStartsWith(self)
+        )
+
+    test_queryStartsWith.todo = "?"
+
+
+    def test_queryStartsWithNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryStartsWithNoIndex(self)
+        )
+
+    test_queryStartsWithNoIndex.todo = "?"
+
+
+    def test_queryStartsWithNot(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryStartsWithNot(self)
+
+    test_queryStartsWithNot.todo = "?"
+
+
+    def test_queryStartsWithNotAny(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryStartsWithNotAny(self)
+        )
+
+    test_queryStartsWithNotAny.todo = "?"
+
+
+    def test_queryStartsWithNotNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryStartsWithNotNoIndex(self)
+        )
+
+    test_queryStartsWithNotNoIndex.todo = "?"
+
+
+    def test_queryStartsWithCaseInsensitive(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryStartsWithCaseInsensitive(self)
+        )
+
+    test_queryStartsWithCaseInsensitive.todo = "?"
+
+
+    def test_queryStartsWithCaseInsensitiveNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryStartsWithCaseInsensitiveNoIndex(self)
+        )
+
+    test_queryStartsWithCaseInsensitiveNoIndex.todo = "?"
+
+
+    def test_queryContains(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryContains(self)
+
+    test_queryContains.todo = "?"
+
+
+    def test_queryContainsNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryContainsNoIndex(self)
+        )
+
+    test_queryContainsNoIndex.todo = "?"
+
+
+    def test_queryContainsNot(self):
+        return BaseDirectoryServiceQueryTestMixIn.test_queryContainsNot(self)
+
+    test_queryContainsNot.todo = "?"
+
+
+    def test_queryContainsNotNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryContainsNotNoIndex(self)
+        )
+
+    test_queryContainsNotNoIndex.todo = "?"
+
+
+    def test_queryContainsCaseInsensitive(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryContainsCaseInsensitive(self)
+        )
+
+    test_queryContainsCaseInsensitive.todo = "?"
+
+
+    def test_queryContainsCaseInsensitiveNoIndex(self):
+        return (
+            BaseDirectoryServiceQueryTestMixIn
+            .test_queryContainsCaseInsensitiveNoIndex(self)
+        )
+
+    test_queryContainsCaseInsensitiveNoIndex.todo = "?"
+
+
+
 class DirectoryServiceConnectionTestMixIn(object):
     @inlineCallbacks
     def test_connect_defaults(self):
@@ -212,7 +385,8 @@
 class DirectoryServiceTest(
     BaseTestCase,
     DirectoryServiceConvenienceTestMixIn,
-    BaseDirectoryServiceRealmTestMixIn,
+    DirectoryServiceRealmTestMixIn,
+    DirectoryServiceQueryTestMixIn,
     DirectoryServiceConnectionTestMixIn,
     test_directory.BaseDirectoryServiceTest,
     unittest.TestCase,
@@ -221,7 +395,13 @@
     directoryRecordClass = DirectoryRecord
 
 
+    def test_repr(self):
+        service = self.service()
 
+        self.assertEquals(repr(service), u"<TestService u'ldap://localhost/'>")
+
+
+
 def mockDirectoryDataFromXMLService(service):
     dc0 = u"org"
     dc1 = u"calendarserver"

Modified: twext/trunk/twext/who/test/test_xml.py
===================================================================
--- twext/trunk/twext/who/test/test_xml.py	2014-01-18 19:49:04 UTC (rev 12395)
+++ twext/trunk/twext/who/test/test_xml.py	2014-01-18 20:09:06 UTC (rev 12396)
@@ -663,9 +663,9 @@
     def test_repr(self):
         service = self.service()
 
-        self.assertEquals(repr(service), "<TestService (not loaded)>")
+        self.assertEquals(repr(service), u"<TestService (not loaded)>")
         service.loadRecords()
-        self.assertEquals(repr(service), "<TestService u'xyzzy'>")
+        self.assertEquals(repr(service), u"<TestService u'xyzzy'>")
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/16dda539/attachment.html>


More information about the calendarserver-changes mailing list