[CalendarServer-changes] [11987] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:21:49 PDT 2014
Revision: 11987
http://trac.calendarserver.org//changeset/11987
Author: wsanchez at apple.com
Date: 2013-11-20 12:57:12 -0800 (Wed, 20 Nov 2013)
Log Message:
-----------
Fix aggregate tests
Modified Paths:
--------------
CalendarServer/trunk/twext/who/aggregate.py
CalendarServer/trunk/twext/who/test/test_aggregate.py
CalendarServer/trunk/twext/who/test/test_xml.py
Modified: CalendarServer/trunk/twext/who/aggregate.py
===================================================================
--- CalendarServer/trunk/twext/who/aggregate.py 2013-11-20 19:05:25 UTC (rev 11986)
+++ CalendarServer/trunk/twext/who/aggregate.py 2013-11-20 20:57:12 UTC (rev 11987)
@@ -30,8 +30,8 @@
from twext.who.idirectory import DirectoryConfigurationError
from twext.who.idirectory import IDirectoryService
-from twext.who.index import DirectoryService as BaseDirectoryService
-from twext.who.index import DirectoryRecord
+from twext.who.directory import DirectoryService as BaseDirectoryService
+from twext.who.directory import DirectoryRecord
from twext.who.util import ConstantsContainer
@@ -68,10 +68,6 @@
return self._services
- def loadRecords(self):
- pass
-
-
@property
def recordType(self):
if not hasattr(self, "_recordType"):
Modified: CalendarServer/trunk/twext/who/test/test_aggregate.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_aggregate.py 2013-11-20 19:05:25 UTC (rev 11986)
+++ CalendarServer/trunk/twext/who/test/test_aggregate.py 2013-11-20 20:57:12 UTC (rev 11987)
@@ -25,13 +25,15 @@
from twext.who.aggregate import DirectoryService, DirectoryRecord
from twext.who.util import ConstantsContainer
from twext.who.test import test_directory, test_xml
-from twext.who.test.test_xml import QueryMixIn, xmlService
-from twext.who.test.test_xml import TestService as XMLTestService
+from twext.who.test.test_xml import (
+ QueryMixIn, xmlService,
+ TestService as XMLTestService,
+ DirectoryServiceConvenienceTestMixIn
+)
-
class BaseTest(object):
- def service(self, subClass=None, services=None):
+ def service(self, services=None):
if services is None:
services = (self.xmlService(),)
@@ -45,10 +47,7 @@
for s in services
))
- if subClass is None:
- subClass = DirectoryService
-
- class TestService(subClass, QueryMixIn):
+ class TestService(DirectoryService, QueryMixIn):
pass
return TestService(u"xyzzy", services)
@@ -63,7 +62,12 @@
-class DirectoryServiceTest(BaseTest, test_xml.DirectoryServiceTest):
+class DirectoryServiceTest(
+ unittest.TestCase,
+ BaseTest,
+ DirectoryServiceConvenienceTestMixIn,
+ test_directory.BaseDirectoryServiceTest
+):
serviceClass = DirectoryService
directoryRecordClass = DirectoryRecord
@@ -88,7 +92,7 @@
class AggregatedBaseTest(BaseTest):
- def service(self, subClass=None):
+ def service(self):
class UsersDirectoryService(XMLTestService):
recordType = ConstantsContainer((XMLTestService.recordType.user,))
@@ -106,7 +110,6 @@
return BaseTest.service(
self,
- subClass=None,
services=(usersService, groupsService)
)
Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py 2013-11-20 19:05:25 UTC (rev 11986)
+++ CalendarServer/trunk/twext/who/test/test_xml.py 2013-11-20 20:57:12 UTC (rev 11987)
@@ -52,22 +52,7 @@
-class DirectoryServiceTest(
- unittest.TestCase,
- BaseTest,
- test_index.BaseDirectoryServiceTest,
-):
- serviceClass = DirectoryService
- directoryRecordClass = DirectoryRecord
-
- def test_repr(self):
- service = self.service()
-
- self.assertEquals(repr(service), "<TestService (not loaded)>")
- service.loadRecords()
- self.assertEquals(repr(service), "<TestService u'xyzzy'>")
-
-
+class DirectoryServiceConvenienceTestMixIn(BaseTest):
@inlineCallbacks
def test_recordWithUID(self):
service = self.service()
@@ -183,6 +168,23 @@
+class DirectoryServiceTest(
+ unittest.TestCase,
+ DirectoryServiceConvenienceTestMixIn,
+ test_index.BaseDirectoryServiceTest,
+):
+ serviceClass = DirectoryService
+ directoryRecordClass = DirectoryRecord
+
+ def test_repr(self):
+ service = self.service()
+
+ self.assertEquals(repr(service), "<TestService (not loaded)>")
+ service.loadRecords()
+ self.assertEquals(repr(service), "<TestService u'xyzzy'>")
+
+
+
class DirectoryServiceRealmTest(unittest.TestCase, BaseTest):
def test_realmNameImmutable(self):
def setRealmName():
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/97d98550/attachment.html>
More information about the calendarserver-changes
mailing list