[CalendarServer-changes] [11982] CalendarServer/trunk/twext/who/test/test_index.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:23:02 PDT 2014
Revision: 11982
http://trac.calendarserver.org//changeset/11982
Author: wsanchez at apple.com
Date: 2013-11-19 18:54:52 -0800 (Tue, 19 Nov 2013)
Log Message:
-----------
More refactoring
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 02:49:52 UTC (rev 11981)
+++ CalendarServer/trunk/twext/who/test/test_index.py 2013-11-20 02:54:52 UTC (rev 11982)
@@ -53,22 +53,28 @@
Tests for indexed directory services.
"""
- def test_indexRecords_positive(self):
- """
- L{DirectoryService.indexRecords} ensures all record data is in the
- index.
- """
+ def noLoadServicePopulated(self):
service = self.service(
subClass=noLoadDirectoryService(self.serviceClass)
)
- records = RecordStorage(service, DirectoryRecord)
+ records = RecordStorage(service, DirectoryRecord)
service.indexRecords(records)
+ service.records = records
+
+ return service
+
+ def test_indexRecords_positive(self):
+ """
+ L{DirectoryService.indexRecords} ensures all record data is in the
+ index.
+ """
+ service = self.noLoadServicePopulated()
index = service.index
# Verify that the fields that should be indexed are, in fact, indexed
# for each record.
- for record in records:
+ for record in service.records:
for fieldName in service.indexedFields:
values = record.fields.get(fieldName, None)
@@ -90,12 +96,7 @@
"""
L{DirectoryService.indexRecords} does not have extra data in the index.
"""
- service = self.service(
- subClass=noLoadDirectoryService(self.serviceClass)
- )
- records = RecordStorage(service, DirectoryRecord)
-
- service.indexRecords(records)
+ service = self.noLoadServicePopulated()
index = service.index
# Verify that all data in the index cooresponds to the records passed
@@ -116,13 +117,8 @@
"""
C{flush} empties the index.
"""
- service = self.service(
- subClass=noLoadDirectoryService(self.serviceClass)
- )
+ service = self.noLoadServicePopulated()
- records = RecordStorage(service, DirectoryRecord)
- service.indexRecords(records)
-
self.assertFalse(emptyIndex(service.index)) # Test the test
service.flush()
self.assertTrue(emptyIndex(service.index))
@@ -132,13 +128,8 @@
"""
L{DirectoryService.indexedRecordsFromMatchExpression} ...
"""
- service = self.service(
- subClass=noLoadDirectoryService(self.serviceClass)
- )
+ # service = self.noLoadServicePopulated()
- records = RecordStorage(service, DirectoryRecord)
- service.indexRecords(records)
-
raise NotImplementedError()
test_indexedRecordsFromMatchExpression_startsWith.todo = "Unimplemented"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/01680c67/attachment.html>
More information about the calendarserver-changes
mailing list