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

source_changes at macosforge.org source_changes at macosforge.org
Mon Feb 11 11:54:14 PST 2013


Revision: 10680
          http://trac.calendarserver.org//changeset/10680
Author:   wsanchez at apple.com
Date:     2013-02-11 11:54:14 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Implement test_addRecord

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-11 19:47:55 UTC (rev 10679)
+++ CalendarServer/trunk/twext/who/test/test_xml.py	2013-02-11 19:54:14 UTC (rev 10680)
@@ -290,14 +290,32 @@
 
     @inlineCallbacks
     def test_addRecord(self):
-        #service = self._testService()
+        service = self._testService()
 
-        raise NotImplementedError()
+        newRecord = DirectoryRecord(
+            service,
+            fields = {
+                service.fieldName.uid:        "__plugh__",
+                service.fieldName.recordType: service.recordType.user,
+                service.fieldName.shortNames: ("plugh",),
+            }
+        )
 
+        yield service.updateRecords((newRecord,), create=True)
+
+        # Verify change is present immediately
+        record = (yield service.recordWithUID("__plugh__"))
+        self.assertEquals(set(record.shortNames), set(("plugh",)))
+
+        # Verify change is persisted
+        service.flush()
+        record = (yield service.recordWithUID("__plugh__"))
+        self.assertEquals(set(record.shortNames), set(("plugh",)))
+
     test_addRecord.todo = "Not implemented."
 
 
-    def test_addRecordNo(self):
+    def test_addRecordNoCreate(self):
         service = self._testService()
 
         newRecord = DirectoryRecord(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/7fc69355/attachment.html>


More information about the calendarserver-changes mailing list