[CalendarServer-changes] [4603] CalendarServer/branches/users/sagen/deployment-inherit-fds-4571/ twistedcaldav/directory/test/test_opendirectoryrecords.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Oct 19 15:38:43 PDT 2009
Revision: 4603
http://trac.macosforge.org/projects/calendarserver/changeset/4603
Author: sagen at apple.com
Date: 2009-10-19 15:38:42 -0700 (Mon, 19 Oct 2009)
Log Message:
-----------
Adds a test for the "substantial decline" protection logic
Modified Paths:
--------------
CalendarServer/branches/users/sagen/deployment-inherit-fds-4571/twistedcaldav/directory/test/test_opendirectoryrecords.py
Modified: CalendarServer/branches/users/sagen/deployment-inherit-fds-4571/twistedcaldav/directory/test/test_opendirectoryrecords.py
===================================================================
--- CalendarServer/branches/users/sagen/deployment-inherit-fds-4571/twistedcaldav/directory/test/test_opendirectoryrecords.py 2009-10-19 20:23:37 UTC (rev 4602)
+++ CalendarServer/branches/users/sagen/deployment-inherit-fds-4571/twistedcaldav/directory/test/test_opendirectoryrecords.py 2009-10-19 22:38:42 UTC (rev 4603)
@@ -461,6 +461,42 @@
user3 = self._service.recordWithCalendarUserAddress("mailto:user03 at example.com")
self.assertTrue(user3 is not None)
+
+ def test_substantialDecline(self):
+ """
+ Test the "substantial decline" protection logic in the case where an
+ od query returns less than half the results of the previous
+ successful one.
+ """
+
+ self._service.fakerecords = {
+ DirectoryService.recordType_users: [
+ fakeODRecord("User 01"),
+ fakeODRecord("User 02"),
+ fakeODRecord("User 03"),
+ fakeODRecord("User 04"),
+ fakeODRecord("User 05"),
+ fakeODRecord("User 06"),
+ ],
+ DirectoryService.recordType_groups: [],
+ DirectoryService.recordType_resources: [],
+ DirectoryService.recordType_locations: [],
+ }
+ self._service.refresh(loop=False)
+ self._service.reloadCache(DirectoryService.recordType_users, forceUpdate=True)
+ user1 = self._service.recordWithCalendarUserAddress("mailto:user01 at example.com")
+ self.assertTrue(user1 is not None)
+
+ # Pretend OD suddenly returned less than half:
+ self._service.fakerecords[DirectoryService.recordType_users] = [
+ fakeODRecord("User 01"),
+ fakeODRecord("User 02"),
+ ]
+ self._service.refresh(loop=False)
+ self._service.reloadCache(DirectoryService.recordType_users, forceUpdate=True)
+ user3 = self._service.recordWithCalendarUserAddress("mailto:user03 at example.com")
+ self.assertTrue(user3 is not None)
+
def fakeODRecord(fullName, shortName=None, guid=None, email=None, addLocator=True, members=None):
if shortName is None:
shortName = shortNameForFullName(fullName)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091019/4ecf1b8d/attachment-0001.html>
More information about the calendarserver-changes
mailing list