[CalendarServer-changes] [6515] CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/ test/test_caldav.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 1 14:19:17 PDT 2010


Revision: 6515
          http://trac.macosforge.org/projects/calendarserver/changeset/6515
Author:   glyph at apple.com
Date:     2010-11-01 14:19:15 -0700 (Mon, 01 Nov 2010)
Log Message:
-----------
fix a couple of tests that depend too strictly on the service hierarchy

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/test/test_caldav.py

Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/test/test_caldav.py	2010-11-01 21:18:59 UTC (rev 6514)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/test/test_caldav.py	2010-11-01 21:19:15 UTC (rev 6515)
@@ -359,7 +359,8 @@
         """
         service = self.makeService()
 
-        return service.services[0].args[1].protocolArgs["requestFactory"]
+        # FIXME: should at least use service name, not index
+        return service.services[2].args[1].protocolArgs["requestFactory"]
 
 
 
@@ -489,20 +490,23 @@
         """
         service = self.makeService()
 
-        expectedSubServices = (
+        expectedSubServices = dict((
             (MaxAcceptTCPServer, self.config["HTTPPort"]),
             (MaxAcceptSSLServer, self.config["SSLPort"]),
-        )
+        ))
 
-        configuredSubServices = [(s.__class__, s.args) for s in service.services]
-
+        configuredSubServices = [(s.__class__, getattr(s, 'args', None))
+                                 for s in service.services]
+        checked = 0
         for serviceClass, serviceArgs in configuredSubServices:
-            self.failUnless(serviceClass in (s[0] for s in expectedSubServices))
+            if serviceClass in expectedSubServices:
+                checked += 1
+                self.assertEquals(
+                    serviceArgs[0],
+                    dict(expectedSubServices)[serviceClass]
+                )
+        self.assertEquals(checked, len(expectedSubServices))
 
-            self.assertEquals(
-                serviceArgs[0],
-                dict(expectedSubServices)[serviceClass]
-            )
 
     def test_SSLKeyConfiguration(self):
         """
@@ -619,7 +623,8 @@
         service = self.makeService()
 
         for s in service.services:
-            self.assertEquals(s.kwargs["backlog"], 1024)
+            if isinstance(s, (internet.TCPServer, internet.SSLServer)):
+                self.assertEquals(s.kwargs["backlog"], 1024)
 
 
 class ServiceHTTPFactoryTests(BaseServiceMakerTests):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101101/06c33d7c/attachment.html>


More information about the calendarserver-changes mailing list