[CalendarServer-changes] [4646] CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/ test
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 27 13:45:46 PDT 2009
Revision: 4646
http://trac.macosforge.org/projects/calendarserver/changeset/4646
Author: glyph at apple.com
Date: 2009-10-27 13:45:45 -0700 (Tue, 27 Oct 2009)
Log Message:
-----------
coerce the tests to pass by aggregating an empty XML directory service
Modified Paths:
--------------
CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/test_aggregate.py
Added Paths:
-----------
CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/accounts2.xml
Added: CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/accounts2.xml
===================================================================
--- CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/accounts2.xml (rev 0)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/accounts2.xml 2009-10-27 20:45:45 UTC (rev 4646)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2009 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "../../../conf/accounts.dtd">
+
+<accounts realm="Test" />
Modified: CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/test_aggregate.py
===================================================================
--- CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/test_aggregate.py 2009-10-27 20:43:37 UTC (rev 4645)
+++ CalendarServer/branches/more-deferreds-3/twistedcaldav/directory/test/test_aggregate.py 2009-10-27 20:45:45 UTC (rev 4646)
@@ -14,24 +14,43 @@
# limitations under the License.
##
-from twistedcaldav.directory.apache import BasicDirectoryService
+from twistedcaldav.directory.directory import DirectoryService
from twistedcaldav.directory.xmlfile import XMLDirectoryService
from twistedcaldav.directory.aggregate import AggregateDirectoryService
-from twistedcaldav.directory.test.test_apache import digestRealm, basicUserFile, groupFile
from twistedcaldav.directory.test.test_xmlfile import xmlFile
-import twistedcaldav.directory.test.util
+from twistedcaldav.directory.test.util import DirectoryTestCase
+from twistedcaldav.directory.test.test_xmlfile import XMLFile
-apache_prefix = "apache:"
-xml_prefix = "xml:"
+node1_prefix = "node1:"
+node2_prefix = "node2:"
+
+class XMLFile2(object):
+ """
+ Dummy values for accounts2.xml
+ """
+ recordTypes = set((
+ DirectoryService.recordType_users,
+ DirectoryService.recordType_groups,
+ DirectoryService.recordType_locations,
+ DirectoryService.recordType_resources
+ ))
+
+ # XXX: this should match the old 'basic' and 'groups' files.
+ users = {}
+ groups = {}
+ locations = {}
+ resources = {}
+
+
testServices = (
- (apache_prefix, twistedcaldav.directory.test.test_apache.Apache ),
- (xml_prefix , twistedcaldav.directory.test.test_xmlfile.XMLFile),
+ (node1_prefix, XMLFile),
+ (node2_prefix, XMLFile2)
)
-class AggregatedDirectories (twistedcaldav.directory.test.util.DirectoryTestCase):
+class AggregatedDirectories(DirectoryTestCase):
def _recordTypes(self):
recordTypes = set()
for prefix, testClass in testServices:
@@ -65,16 +84,17 @@
"""
Returns an IDirectoryService.
"""
- apacheService = BasicDirectoryService(
- {
- 'realmName' : digestRealm,
- 'userFile' : basicUserFile,
- 'groupFile' : groupFile,
- }
- )
- apacheService.recordTypePrefix = apache_prefix
- xmlService = XMLDirectoryService({'xmlFile' : xmlFile})
- xmlService.recordTypePrefix = xml_prefix
+ node1Service = XMLDirectoryService({'xmlFile' : xmlFile})
+ node1Service.recordTypePrefix = node1_prefix
- return AggregateDirectoryService((apacheService, xmlService))
+ fn, ext = xmlFile.basename().split(".")
+ otherFile = xmlFile.sibling(fn+'2.'+ext)
+ node2Service = XMLDirectoryService({'xmlFile': otherFile})
+ node2Service.recordTypePrefix = node2_prefix
+
+ return AggregateDirectoryService((node1Service, node2Service))
+
+del DirectoryTestCase # DirectoryTestCase is a bad test-citizen and
+ # subclasses TestCase even though it does not
+ # want to be discovered as such.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091027/246c1c79/attachment.html>
More information about the calendarserver-changes
mailing list