[CalendarServer-changes] [499]
CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/
directory/test/test_xmlfile.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Nov 16 18:28:56 PST 2006
Revision: 499
http://trac.macosforge.org/projects/calendarserver/changeset/499
Author: wsanchez at apple.com
Date: 2006-11-16 18:28:55 -0800 (Thu, 16 Nov 2006)
Log Message:
-----------
Add test to make sure that XML file changes are reflected properly in the directory.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_xmlfile.py
Modified: CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_xmlfile.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_xmlfile.py 2006-11-17 02:15:33 UTC (rev 498)
+++ CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/test/test_xmlfile.py 2006-11-17 02:28:55 UTC (rev 499)
@@ -18,10 +18,12 @@
import os
+from twisted.python.filepath import FilePath
+
import twistedcaldav.directory.test.util
from twistedcaldav.directory.xmlfile import XMLDirectoryService
-xmlFile = os.path.join(os.path.dirname(__file__), "accounts.xml")
+xmlFile = FilePath(os.path.join(os.path.dirname(__file__), "accounts.xml"))
# FIXME: Add tests for GUID hooey, once we figure out what that means here
@@ -55,5 +57,28 @@
"apollo",
))
+ def xmlFile(self):
+ if not hasattr(self, "_xmlFile"):
+ self._xmlFile = FilePath(self.mktemp())
+ xmlFile.copyTo(self._xmlFile)
+ return self._xmlFile
+
def service(self):
- return XMLDirectoryService(xmlFile)
+ return XMLDirectoryService(self.xmlFile())
+
+ def test_changedXML(self):
+ self.xmlFile().open("w").write(
+"""<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+<accounts>
+ <user>
+ <uid>admin</uid>
+ <pswd>nimda</pswd>
+ <name>Super User</name>
+ </user>
+</accounts>
+"""
+ )
+ self.assertEquals(set(self.service().listRecords("user")), set(("admin",)))
+ self.assertEquals(set(self.service().listRecords("group")), set())
+ self.assertEquals(set(self.service().listRecords("resource")), set())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061116/74dfcf53/attachment.html
More information about the calendarserver-changes
mailing list