[CalendarServer-changes] [1274] CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 27 09:33:12 PST 2007


Revision: 1274
          http://trac.macosforge.org/projects/calendarserver/changeset/1274
Author:   dreid at apple.com
Date:     2007-02-27 09:33:12 -0800 (Tue, 27 Feb 2007)

Log Message:
-----------
Update a bunch of configuration keys

Modified Paths:
--------------
    CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/tap.py
    CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/test/test_tap.py

Modified: CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/tap.py	2007-02-27 04:17:54 UTC (rev 1273)
+++ CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/tap.py	2007-02-27 17:33:12 UTC (rev 1274)
@@ -109,7 +109,7 @@
 
                 elif isinstance(defaultConfig[key], dict):
                     raise UsageError("Dict options not supported on the command line")
-                        
+
                 elif value == 'None':
                     value = None
 
@@ -160,7 +160,7 @@
             uname=config.UserName,
             gname=config.GroupName
         )
-            
+
         # Verify that ssl certs exist if needed
         if config.SSLPort:
             self.checkFile(
@@ -182,12 +182,12 @@
 
         if not config.ErrorLogFile and config.ProcessType == 'Slave':
             log.FileLogObserver.timeFormat = ''
-        
+
         # Check current umask and warn if changed
         oldmask = os.umask(0027)
         if oldmask != 0027:
             print "WARNING: changing umask from: 0%03o to 0%03o" % (oldmask, 0027,)
-        
+
     def checkDirectory(self, dirpath, description, access=None, fail=False, permissions=None, uname=None, gname=None):
         if not os.path.exists(dirpath):
             raise ConfigurationError("%s does not exist: %s" % (description, dirpath,))
@@ -196,7 +196,7 @@
         elif access and not os.access(dirpath, access):
             raise ConfigurationError("Insufficient permissions for server on %s directory: %s" % (description, dirpath,))
         self.securityCheck(dirpath, description, fail=fail, permissions=permissions, uname=uname, gname=gname)
-    
+
     def checkFile(self, filepath, description, access=None, fail=False, permissions=None, uname=None, gname=None):
         if not os.path.exists(filepath):
             raise ConfigurationError("%s does not exist: %s" % (description, filepath,))
@@ -228,7 +228,7 @@
             except KeyError:
                 raiseOrPrint("The owner of %s directory %s is unknown (%s) and does not match the expected owner: %s"
                              % (description, path, pathstat[stat.ST_UID], uname))
-                    
+
         if gname:
             import grp
             try:
@@ -239,8 +239,8 @@
             except KeyError:
                 raiseOrPrint("The group of %s directory %s is unknown (%s) and does not match the expected group: %s"
                              % (description, path, pathstat[stat.ST_GID], gname))
-                    
 
+
 class CalDAVServiceMaker(object):
     implements(IPlugin, service.IServiceMaker)
 
@@ -265,10 +265,10 @@
         directories = []
 
         directoryClass = namedClass(config.DirectoryService['type'])
-        
+
         log.msg("Configuring directory service of type: %s"
                 % (config.DirectoryService['type'],))
-        
+
         baseDirectory = directoryClass(**config.DirectoryService['params'])
 
         directories.append(baseDirectory)
@@ -278,7 +278,7 @@
         if config.SudoersFile and os.path.exists(config.SudoersFile):
             log.msg("Configuring SudoDirectoryService with file: %s"
                     % (config.SudoersFile,))
-                
+
             sudoDirectory = SudoDirectoryService(config.SudoersFile)
             sudoDirectory.realmName = baseDirectory.realmName
 
@@ -299,7 +299,7 @@
         #
 
         log.msg("Setting up document root at: %s" % (config.DocumentRoot,))
-        
+
         log.msg("Setting up principal collection: %r" % (self.principalResourceClass,))
 
         principalCollection = self.principalResourceClass(
@@ -425,7 +425,7 @@
             config.AccessLogFile,))
 
         logObserver = RotatingFileAccessLoggingObserver(config.AccessLogFile)
-        
+
         service = CalDAVService(logObserver)
 
         if not config.BindAddresses:
@@ -449,13 +449,13 @@
 
             for port in config.BindHTTPPorts:
                 log.msg("Adding server at %s:%s" % (bindAddress, port))
-                
+
                 httpService = internet.TCPServer(int(port), channel, interface=bindAddress)
                 httpService.setServiceParent(service)
 
             for port in config.BindSSLPorts:
                 log.msg("Adding SSL server at %s:%s" % (bindAddress, port))
-            
+
                 httpsService = internet.SSLServer(
                     int(port), channel,
                     DefaultOpenSSLContextFactory(config.SSLPrivateKey, config.SSLCertificate),

Modified: CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/test/test_tap.py
===================================================================
--- CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/test/test_tap.py	2007-02-27 04:17:54 UTC (rev 1273)
+++ CalendarServer/branches/users/dreid/tap-tests-2/twistedcaldav/test/test_tap.py	2007-02-27 17:33:12 UTC (rev 1274)
@@ -48,10 +48,10 @@
     empty implementations of checkDirectory and checkFile.
     """
 
-    def checkDirectory(*args):
+    def checkDirectory(*args, **kwargs):
         pass
 
-    def checkFile(*args):
+    def checkFile(*args, **kwargs):
         pass
 
 
@@ -79,23 +79,23 @@
         overide the config file
         """
 
-        argv = ['-o', 'SACLEnable',
-                '-o', 'Port=80',
-                '-o', 'BindAddress=127.0.0.1,127.0.0.2,127.0.0.3',
+        argv = ['-o', 'EnableSACLs',
+                '-o', 'HTTPPort=80',
+                '-o', 'BindAddresses=127.0.0.1,127.0.0.2,127.0.0.3',
                 '-o', 'DocumentRoot=/dev/null',
-                '-o', 'Username=None',
-                '-o', 'CalendarUserProxyEnabled=False']
+                '-o', 'UserName=None',
+                '-o', 'EnableProxyPrincipals=False']
 
         self.config.parseOptions(argv)
 
-        self.assertEquals(config.SACLEnable, True)
-        self.assertEquals(config.Port, 80)
-        self.assertEquals(config.BindAddress, ['127.0.0.1',
+        self.assertEquals(config.EnableSACLs, True)
+        self.assertEquals(config.HTTPPort, 80)
+        self.assertEquals(config.BindAddresses, ['127.0.0.1',
                                                '127.0.0.2',
                                                '127.0.0.3'])
         self.assertEquals(config.DocumentRoot, '/dev/null')
-        self.assertEquals(config.Username, None)
-        self.assertEquals(config.CalendarUserProxyEnabled, False)
+        self.assertEquals(config.UserName, None)
+        self.assertEquals(config.EnableProxyPrincipals, False)
 
         argv = ['-o', 'Authentication=This Doesn\'t Matter']
 
@@ -128,7 +128,7 @@
 
         myConfig['MultiProcess']['LoadBalancer']['Enabled'] = False
 
-        myConfig['Port'] = 80
+        myConfig['HTTPPort'] = 80
 
         myConfig['ServerHostName'] = 'calendar.calenderserver.org'
 
@@ -144,7 +144,7 @@
         self.assertEquals(config.MultiProcess['LoadBalancer']['Enabled'],
                           myConfig['MultiProcess']['LoadBalancer']['Enabled'])
 
-        self.assertEquals(config.Port, myConfig['Port'])
+        self.assertEquals(config.HTTPPort, myConfig['HTTPPort'])
 
         self.assertEquals(config.Authentication['Basic']['Enabled'],
                           myConfig['Authentication']['Basic']['Enabled'])
@@ -173,9 +173,11 @@
 
         self.config['DocumentRoot'] = self.mktemp()
 
+        self.config['HTTPPort'] = 8008
+        self.config['SSLPort'] = 8443
+
         self.config['SSLPrivateKey'] = sibpath(__file__, 'data/server.pem')
         self.config['SSLCertificate'] = sibpath(__file__, 'data/server.pem')
-        self.config['SSLOnly'] = False
 
         os.mkdir(self.config['DocumentRoot'])
 
@@ -259,7 +261,7 @@
 
         service = self.makeService()
 
-        expectedSubServices = ((internet.TCPServer, self.config['Port']),
+        expectedSubServices = ((internet.TCPServer, self.config['HTTPPort']),
                                (internet.SSLServer, self.config['SSLPort']))
 
         configuredSubServices = [(s.__class__, s.args)
@@ -300,10 +302,13 @@
         is disabled
         """
 
-        self.config['SSLEnable'] = False
+        del self.config['SSLPort']
         self.writeConfig()
         service = self.makeService()
+        import pdb; pdb.set_trace()
 
+        self.config['SSLPort']
+
         self.failIf(
             internet.SSLServer in [s.__class__ for s in service.services])
 
@@ -313,32 +318,32 @@
         SSLOnly is turned on.
         """
 
-        self.config['SSLOnly'] = True
+        del self.config['HTTPPort']
         self.writeConfig()
         service = self.makeService()
 
         self.failIf(
             internet.TCPServer in [s.__class__ for s in service.services])
 
-    def test_singleBindAddress(self):
+    def test_singleBindAddresses(self):
         """
         Test that the TCPServer and SSLServers are bound to the proper address
         """
 
-        self.config['BindAddress'] = ['127.0.0.1']
+        self.config['BindAddresses'] = ['127.0.0.1']
         self.writeConfig()
         service = self.makeService()
 
         for s in service.services:
             self.assertEquals(s.kwargs['interface'], '127.0.0.1')
 
-    def test_multipleBindAddress(self):
+    def test_multipleBindAddresses(self):
         """
         Test that the TCPServer and SSLServers are bound to the proper
         addresses.
         """
 
-        self.config['BindAddress'] = ['127.0.0.1', '10.0.0.2', '172.53.13.123']
+        self.config['BindAddresses'] = ['127.0.0.1', '10.0.0.2', '172.53.13.123']
         self.writeConfig()
         service = self.makeService()
 
@@ -351,10 +356,10 @@
             elif isinstance(s, internet.SSLServer):
                 sslServers.append(s)
 
-        self.assertEquals(len(tcpServers), len(self.config['BindAddress']))
-        self.assertEquals(len(sslServers), len(self.config['BindAddress']))
+        self.assertEquals(len(tcpServers), len(self.config['BindAddresses']))
+        self.assertEquals(len(sslServers), len(self.config['BindAddresses']))
 
-        for addr in self.config['BindAddress']:
+        for addr in self.config['BindAddresses']:
             for s in tcpServers:
                 if s.kwargs['interface'] == addr:
                     tcpServers.remove(s)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070227/1c083ff9/attachment.html


More information about the calendarserver-changes mailing list