[CalendarServer-changes] [500]
CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/
directory/test/test_apache.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Nov 16 18:39:33 PST 2006
Revision: 500
http://trac.macosforge.org/projects/calendarserver/changeset/500
Author: wsanchez at apple.com
Date: 2006-11-16 18:39:33 -0800 (Thu, 16 Nov 2006)
Log Message:
-----------
Add tests for changes to userfile and groupfile to make sure they are reflected in the directory.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_apache.py
Modified: CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_apache.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_apache.py 2006-11-17 02:28:55 UTC (rev 499)
+++ CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_apache.py 2006-11-17 02:39:33 UTC (rev 500)
@@ -18,14 +18,16 @@
import os
+from twisted.python.filepath import FilePath
+
import twistedcaldav.directory.test.util
from twistedcaldav.directory.apache import BasicDirectoryService
digestRealm = "Test"
-basicUserFile = os.path.join(os.path.dirname(__file__), "basic")
-digestUserFile = os.path.join(os.path.dirname(__file__), "digest")
-groupFile = os.path.join(os.path.dirname(__file__), "groups")
+basicUserFile = FilePath(os.path.join(os.path.dirname(__file__), "basic"))
+digestUserFile = FilePath(os.path.join(os.path.dirname(__file__), "digest"))
+groupFile = FilePath(os.path.join(os.path.dirname(__file__), "groups"))
# FIXME: Add tests for GUID hooey, once we figure out what that means here
@@ -49,11 +51,31 @@
"left_coast" : ("wsanchez", "dreid", "lecroy"),
}
+ def basicUserFile(self):
+ if not hasattr(self, "_basicUserFile"):
+ self._basicUserFile = FilePath(self.mktemp())
+ basicUserFile.copyTo(self._basicUserFile)
+ return self._basicUserFile
+
+ def groupFile(self):
+ if not hasattr(self, "_groupFile"):
+ self._groupFile = FilePath(self.mktemp())
+ groupFile.copyTo(self._groupFile)
+ return self._groupFile
+
def service(self):
- return BasicDirectoryService(basicUserFile, groupFile)
+ return BasicDirectoryService(self.basicUserFile(), self.groupFile())
def test_recordTypes_user(self):
"""
IDirectoryService.recordTypes(userFile)
"""
self.assertEquals(set(BasicDirectoryService(basicUserFile).recordTypes()), set(("user",)))
+
+ def test_changedUserFile(self):
+ self.basicUserFile().open("w").write("wsanchez:Cytm0Bwm7CPJs\n")
+ self.assertEquals(set(self.service().listRecords("user")), set(("wsanchez",)))
+
+ def test_changedGroupFile(self):
+ self.groupFile().open("w").write("grunts: wsanchez\n")
+ self.assertEquals(set(self.service().listRecords("group")), set(("grunts",)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061116/9f58bdb5/attachment.html
More information about the calendarserver-changes
mailing list