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

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


Revision: 11966
          http://trac.calendarserver.org//changeset/11966
Author:   wsanchez at apple.com
Date:     2013-11-18 21:02:42 -0800 (Mon, 18 Nov 2013)
Log Message:
-----------
More test cleanup

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

Modified: CalendarServer/trunk/twext/who/test/test_aggregate.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_aggregate.py	2013-11-19 01:56:41 UTC (rev 11965)
+++ CalendarServer/trunk/twext/who/test/test_aggregate.py	2013-11-19 05:02:42 UTC (rev 11966)
@@ -22,7 +22,7 @@
 from twisted.trial import unittest
 
 from twext.who.idirectory import IDirectoryService, DirectoryConfigurationError
-from twext.who.aggregate import DirectoryService
+from twext.who.aggregate import DirectoryService, DirectoryRecord
 from twext.who.util import ConstantsContainer
 
 from twext.who.test import test_directory, test_xml
@@ -57,7 +57,10 @@
 
 
 
-class DirectoryServiceBaseTest(BaseTest, test_xml.DirectoryServiceBaseTest):
+class DirectoryServiceTest(BaseTest, test_xml.DirectoryServiceTest):
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     def test_repr(self):
         service = self.service()
         self.assertEquals(repr(service), "<TestService u'xyzzy'>")
@@ -73,7 +76,8 @@
     BaseTest,
     test_directory.BaseDirectoryServiceImmutableTest,
 ):
-    pass
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
 
 
 
@@ -100,7 +104,7 @@
 
 class DirectoryServiceAggregatedBaseTest(
     AggregatedBaseTest,
-    DirectoryServiceBaseTest,
+    DirectoryServiceTest,
 ):
     pass
 

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-19 01:56:41 UTC (rev 11965)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-11-19 05:02:42 UTC (rev 11966)
@@ -54,10 +54,6 @@
     """
     Tests for directory services.
     """
-    serviceClass = DirectoryService
-    directoryRecordClass = DirectoryRecord
-
-
     def test_interface(self):
         """
         Service instance conforms to L{IDirectoryService}.
@@ -208,6 +204,12 @@
 
 
 class DirectoryServiceTest(unittest.TestCase, BaseDirectoryServiceTest):
+    """
+    Tests for L{DirectoryService}.
+    """
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     @inlineCallbacks
     def test_recordsFromExpression_single(self):
         """
@@ -405,10 +407,7 @@
     """
     Tests for immutable directory services.
     """
-    serviceClass = DirectoryService
-    directoryRecordClass = DirectoryRecord
 
-
     def test_updateRecordsNotAllowed(self):
         """
         Updating records is not allowed.
@@ -448,7 +447,11 @@
     unittest.TestCase,
     BaseDirectoryServiceImmutableTest,
 ):
-    pass
+    """
+    Tests for immutable L{DirectoryService}.
+    """
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
 
 
 
@@ -456,10 +459,7 @@
     """
     Tests for directory records.
     """
-    serviceClass = DirectoryService
-    directoryRecordClass = DirectoryRecord
 
-
     fields_wsanchez = {
         FieldName.uid: u"UID:wsanchez",
         FieldName.recordType: RecordType.user,
@@ -730,6 +730,12 @@
 
 
 class DirectoryRecordTest(unittest.TestCase, BaseDirectoryRecordTest):
+    """
+    Tests for L{DirectoryRecord}.
+    """
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     def test_members_group(self):
         staff = self.makeRecord(self.fields_staff)
 
@@ -745,7 +751,7 @@
 
 class StubDirectoryService(DirectoryService):
     """
-    Stubn directory service with some built-in records and an implementation
+    Stub directory service with some built-in records and an implementation
     of C{recordsFromNonCompoundExpression}.
     """
 

Modified: CalendarServer/trunk/twext/who/test/test_index.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_index.py	2013-11-19 01:56:41 UTC (rev 11965)
+++ CalendarServer/trunk/twext/who/test/test_index.py	2013-11-19 05:02:42 UTC (rev 11966)
@@ -30,12 +30,18 @@
     """
     Tests for indexed directory services.
     """
+
+
+
+class DirectoryServiceTest(unittest.TestCase, BaseDirectoryServiceTest):
+    """
+    Tests for L{DirectoryService}.
+    """
     serviceClass = DirectoryService
     directoryRecordClass = DirectoryRecord
 
 
 
-class DirectoryServiceTest(unittest.TestCase, BaseDirectoryServiceTest):
     def _noop(self):
         """
         Does nothing for this class.
@@ -58,15 +64,17 @@
     """
     Tests for immutable indexed directory services.
     """
-    serviceClass = DirectoryService
-    directoryRecordClass = DirectoryRecord
 
 
 
 class DirectoryServiceImmutableTest(
     unittest.TestCase, BaseDirectoryServiceImmutableTest
 ):
-    pass
+    """
+    Tests for immutable L{DirectoryService}.
+    """
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
 
 
 
@@ -74,12 +82,16 @@
     """
     Tests for indexed directory records.
     """
-    serviceClass = DirectoryService
-    directoryRecordClass = DirectoryRecord
 
 
 
 class DirectoryRecordTest(unittest.TestCase, BaseDirectoryRecordTest):
+    """
+    Tests for L{DirectoryRecord}.
+    """
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     def _noop(self):
         """
         Does nothing for this class.

Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py	2013-11-19 01:56:41 UTC (rev 11965)
+++ CalendarServer/trunk/twext/who/test/test_xml.py	2013-11-19 05:02:42 UTC (rev 11966)
@@ -36,7 +36,7 @@
 
 
 
-class BaseTest(unittest.TestCase):
+class BaseTest(object):
     def service(self, xmlData=None):
         return xmlService(self.mktemp(), xmlData)
 
@@ -49,10 +49,14 @@
 
 
 
-class DirectoryServiceBaseTest(
+class DirectoryServiceTest(
+    unittest.TestCase,
     BaseTest,
     test_index.BaseDirectoryServiceTest,
 ):
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     def test_repr(self):
         service = self.service()
 
@@ -176,7 +180,7 @@
 
 
 
-class DirectoryServiceRealmTest(BaseTest):
+class DirectoryServiceRealmTest(unittest.TestCase, BaseTest):
     def test_realmNameImmutable(self):
         def setRealmName():
             service = self.service()
@@ -186,7 +190,7 @@
 
 
 
-class DirectoryServiceParsingTest(BaseTest):
+class DirectoryServiceParsingTest(unittest.TestCase, BaseTest):
     def test_reloadInterval(self):
         service = self.service()
 
@@ -232,7 +236,7 @@
         except ParseError as e:
             self.assertTrue(str(e).startswith("Incorrect root element"), e)
         else:
-            raise AssertionError
+            raise AssertionError("Expected ParseError")
 
 
     def test_noRealmName(self):
@@ -250,7 +254,7 @@
         except ParseError as e:
             self.assertTrue(str(e).startswith("No realm name"), e)
         else:
-            raise AssertionError
+            raise AssertionError("Expected ParseError")
 
 
     def test_unknownFieldElementsClean(self):
@@ -301,7 +305,7 @@
 
 
 
-class DirectoryServiceQueryTest(BaseTest):
+class DirectoryServiceQueryTest(unittest.TestCase, BaseTest):
     @inlineCallbacks
     def test_queryAnd(self):
         service = self.service()
@@ -663,7 +667,7 @@
 
 
 
-class DirectoryServiceMutableTest(BaseTest):
+class DirectoryServiceMutableTest(unittest.TestCase, BaseTest):
     @inlineCallbacks
     def test_updateRecord(self):
         service = self.service()
@@ -756,7 +760,14 @@
 
 
 
-class DirectoryRecordTest(BaseTest, test_index.BaseDirectoryRecordTest):
+class DirectoryRecordTest(
+    unittest.TestCase,
+    BaseTest,
+    test_index.BaseDirectoryRecordTest
+):
+    serviceClass = DirectoryService
+    directoryRecordClass = DirectoryRecord
+
     @inlineCallbacks
     def test_members_group(self):
         service = self.service()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/0c8aa670/attachment.html>


More information about the calendarserver-changes mailing list