[CalendarServer-changes] [11968] CalendarServer/trunk/twext/who/test

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:21:34 PDT 2014


Revision: 11968
          http://trac.calendarserver.org//changeset/11968
Author:   wsanchez at apple.com
Date:     2013-11-18 21:56:00 -0800 (Mon, 18 Nov 2013)
Log Message:
-----------
More tests

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

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-19 05:41:48 UTC (rev 11967)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-19 05:56:00 UTC (rev 11968)
@@ -78,7 +78,10 @@
         C{repr} returns the expected string.
         """
         service = self.service()
-        self.assertEquals(repr(service), "<DirectoryService u'xyzzy'>")
+        self.assertEquals(
+            repr(service),
+            "<{0} u'xyzzy'>".format(self.serviceClass.__name__)
+        )
 
 
     def test_recordTypes(self):

Modified: CalendarServer/trunk/twext/who/test/test_index.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_index.py	2013-11-19 05:41:48 UTC (rev 11967)
+++ CalendarServer/trunk/twext/who/test/test_index.py	2013-11-19 05:56:00 UTC (rev 11968)
@@ -25,6 +25,12 @@
 
 
 
+class NoLoadDirectoryService(DirectoryService):
+    def loadRecords(self):
+        pass
+
+
+
 class BaseDirectoryServiceTest(test_directory.BaseDirectoryServiceTest):
     """
     Tests for indexed directory services.
@@ -57,7 +63,7 @@
             def loadRecords(self):
                 self.index = self.indexToLoad
 
-        service = TestService("")
+        service = TestService(u"")
 
         for index in ({}, {}, {}):
             service.indexToLoad = index
@@ -68,22 +74,26 @@
         """
         Setting the index and getting it gives us back the same value.
         """
-        class TestService(DirectoryService):
-            def loadRecords(self):
-                pass
+        service = NoLoadDirectoryService(u"")
 
-        service = TestService("")
-
         for index in ({}, {}, {}):
             service.index = index
             self.assertIdentical(service.index, index)
 
 
+    def test_loadRecords(self):
+        """
+        L{DirectoryService.loadRecords} raises C{NotImplementedError}.
+        """
+        service = self.service()
+        self.assertRaises(NotImplementedError, service.loadRecords)
+
+
     def test_flush(self):
         """
         C{flush} sets the index to C{None}.
         """
-        service = self.service()
+        service = NoLoadDirectoryService(u"")
         service._index = {}
         service.flush()
         self.assertIdentical(service._index, None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/904aa3f6/attachment.html>


More information about the calendarserver-changes mailing list