[CalendarServer-changes] [10606] CalendarServer/trunk/twext/who/test/test_directory.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Jan 30 17:18:39 PST 2013


Revision: 10606
          http://trac.calendarserver.org//changeset/10606
Author:   wsanchez at apple.com
Date:     2013-01-30 17:18:39 -0800 (Wed, 30 Jan 2013)
Log Message:
-----------
Move common bits to BaseTest

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

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-01-31 01:17:35 UTC (rev 10605)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-01-31 01:18:39 UTC (rev 10606)
@@ -28,12 +28,17 @@
 
 
 
-class DirectoryServiceTest(unittest.TestCase):
+class BaseTest(unittest.TestCase):
     realmName = "xyzzy"
 
     def _testService(self):
-        return DirectoryService(self.realmName)
+        if not hasattr(self, "_service"):
+            self._service = DirectoryService(self.realmName)
+        return self._service
 
+
+
+class DirectoryServiceTest(BaseTest):
     def test_interface(self):
         service = self._testService()
         try:
@@ -59,28 +64,23 @@
 
 
 
-class DirectoryRecordTest(unittest.TestCase):
-    realmName = "xyzzy"
-
+class DirectoryRecordTest(BaseTest):
     fields_wsanchez = {
+        FieldName.uid:            "wsanchez",
         FieldName.recordType:     RecordType.user,
-        FieldName.shortNames:     ("wsanchez",),
-        FieldName.uid:            "wsanchez",
+        FieldName.shortNames:     ("wsanchez", "wilfredo_sanchez"),
+        FieldName.fullNames:      ("Wilfredo Sanchez", "Wilfredo Sanchez Vega"),
         FieldName.emailAddresses: ("wsanchez at calendarserver.org", "wsanchez at example.com")
     }
 
     fields_glyph = {
+        FieldName.uid:            "glyph",
         FieldName.recordType:     RecordType.user,
         FieldName.shortNames:     ("glyph",),
-        FieldName.uid:            "glyph",
-        FieldName.emailAddresses: ("glyph at calendarserver.org", "glyph at example.com")
+        FieldName.fullNames:      ("Glyph Lefkowitz",),
+        FieldName.emailAddresses: ("glyph at calendarserver.org",)
     }
 
-    def _testService(self):
-        if not hasattr(self, "_service"):
-            self._service = DirectoryService(self.realmName)
-        return self._service
-
     def _testRecord(self, fields=None, service=None):
         if fields is None:
             fields = self.fields_wsanchez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130130/16d8561f/attachment.html>


More information about the calendarserver-changes mailing list