[CalendarServer-changes] [11980] CalendarServer/trunk/twext/who/test/test_index.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:20:04 PDT 2014


Revision: 11980
          http://trac.calendarserver.org//changeset/11980
Author:   wsanchez at apple.com
Date:     2013-11-19 17:29:56 -0800 (Tue, 19 Nov 2013)
Log Message:
-----------
Rework test_flush.

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

Modified: CalendarServer/trunk/twext/who/test/test_index.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_index.py	2013-11-20 01:24:56 UTC (rev 11979)
+++ CalendarServer/trunk/twext/who/test/test_index.py	2013-11-20 01:29:56 UTC (rev 11980)
@@ -111,7 +111,23 @@
                     self.assertIn(fieldValue, values)
 
 
+    def test_flush(self):
+        """
+        C{flush} empties the index.
+        """
+        service = self.service(
+            subClass=noLoadDirectoryService(self.serviceClass)
+        )
 
+        records = RecordStorage(service, DirectoryRecord)
+        service.indexRecords(records)
+
+        self.assertFalse(emptyIndex(service.index))  # Test the test
+        service.flush()
+        self.assertTrue(emptyIndex(service.index))
+
+
+
 class DirectoryServiceTest(unittest.TestCase, BaseDirectoryServiceTest):
     """
     Tests for L{DirectoryService}.
@@ -151,20 +167,6 @@
         self.assertRaises(NotImplementedError, service.loadRecords)
 
 
-    def test_flush(self):
-        """
-        C{flush} sets the index to C{None}.
-        """
-        service = self.service(
-            subClass=noLoadDirectoryService(self.serviceClass)
-        )
-        service._index = {}
-        service.flush()
-        self.assertTrue(emptyIndex(service._index))
-
-    test_flush.todo = "Redo this"
-
-
     def test_indexedRecordsFromMatchExpression(self):
         """
         L{DirectoryService.indexedRecordsFromMatchExpression} ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/45ac6a1f/attachment.html>


More information about the calendarserver-changes mailing list