[CalendarServer-changes] [10670] CalendarServer/trunk/twext/who/test/test_xml.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 8 16:53:23 PST 2013


Revision: 10670
          http://trac.calendarserver.org//changeset/10670
Author:   wsanchez at apple.com
Date:     2013-02-08 16:53:23 -0800 (Fri, 08 Feb 2013)
Log Message:
-----------
Add test_updateRecord

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/test/test_xml.py

Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py	2013-02-09 00:53:05 UTC (rev 10669)
+++ CalendarServer/trunk/twext/who/test/test_xml.py	2013-02-09 00:53:23 UTC (rev 10670)
@@ -22,7 +22,7 @@
 from twisted.internet.defer import inlineCallbacks
 
 from twext.who.idirectory import RecordType
-from twext.who.xml import DirectoryService
+from twext.who.xml import DirectoryService, DirectoryRecord
 
 from twext.who.test import test_directory
 
@@ -266,7 +266,31 @@
         self.assertEquals(set(service.unknownFieldNames), set())
 
 
+    @inlineCallbacks
+    def test_updateRecord(self):
+        service = self._testService()
 
+        record = (yield service.recordWithUID("__wsanchez__"))
+
+        fields = record.fields.copy()
+        fields[service.fieldName.fullNames] = ["Wilfredo Sanchez Vega"]
+
+        updatedRecord = DirectoryRecord(service, fields)
+        service.updateRecords((updatedRecord,))
+
+        # Verify change is present immediately
+        record = (yield service.recordWithUID("__wsanchez__"))
+        self.assertEquals(record.fullName, "Wilfredo Sanchez Vega")
+
+        # Verify change is persisted
+        service.flush()
+        record = (yield service.recordWithUID("__wsanchez__"))
+        self.assertEquals(record.fullName, "Wilfredo Sanchez Vega")
+
+    test_updateRecord.todo = "Not implemented."
+
+
+
 class DirectoryRecordTest(BaseTest, test_directory.DirectoryRecordTest):
     @inlineCallbacks
     def test_members(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130208/83c499af/attachment.html>


More information about the calendarserver-changes mailing list