Revision: 3622 http://trac.macosforge.org/projects/calendarserver/changeset/3622 Author: cdaboo@apple.com Date: 2009-01-29 09:48:12 -0800 (Thu, 29 Jan 2009) Log Message: ----------- Fix to allow proper testing with OD. Modified Paths: -------------- CalDAVTester/trunk/odsetup.py CalDAVTester/trunk/scripts/server/serverinfo-template.xml CalDAVTester/trunk/scripts/tests/acl.xml Modified: CalDAVTester/trunk/odsetup.py =================================================================== --- CalDAVTester/trunk/odsetup.py 2009-01-29 00:20:08 UTC (rev 3621) +++ CalDAVTester/trunk/odsetup.py 2009-01-29 17:48:12 UTC (rev 3622) @@ -161,13 +161,27 @@ hostname = plist["ServerHostName"] docroot = plist["DocumentRoot"] sudoers = plist["SudoersFile"] + try: + basic_ok = plist["Authentication"]["Basic"]["Enabled"] + except KeyError: + pass + try: + digest_ok = plist["Authentication"]["Digest"]["Enabled"] + except KeyError: + pass + if basic_ok: + authtype = "basic" + elif digest_ok: + authtype = "digest" + if not hostname: + hostname = "localhost" if docroot[0] != "/": docroot = base_dir + docroot if sudoers[0] != "/": sudoers = base_dir + sudoers - return hostname, docroot, sudoers + return hostname, authtype, docroot, sudoers def patchConfig(config, admin): """ @@ -199,7 +213,7 @@ users.append({"username":"superuser", "password": "superuser"}) writePlist(plist, sudoers) -def buildServerinfo(hostname, docroot): +def buildServerinfo(hostname, authtype, docroot): # Read in the serverinfo-template.xml file fd = open(serverinfo_template, "r") @@ -236,6 +250,7 @@ data = data % { "hostname" : hostname, + "authtype" : authtype, "overrides" : subs_str, } @@ -375,7 +390,7 @@ if args[0] == "create": # Read the caldavd.plist file and extract some information we will need. - hostname, docroot, sudoers = readConfig(config) + hostname, authtype, docroot, sudoers = readConfig(config) # Patch the sudoers file for the superuser principal. patchSudoers(sudoers) @@ -387,20 +402,20 @@ patchConfig(config, "/principals/__uids__/%s/" % (guids["testadmin"],)) # Create an appropriate serverinfo.xml file from the template - buildServerinfo(hostname, docroot) + buildServerinfo(hostname, authtype, docroot) # Add large calendars to user account addLargeCalendars(hostname, docroot) elif args[0] == "create-users": # Read the caldavd.plist file and extract some information we will need. - hostname, docroot, sudoers = readConfig(config) + hostname, authtype, docroot, sudoers = readConfig(config) # Now generate the OD accounts (caching guids as we go). doToAccounts(createUser, users_only=True) # Create an appropriate serverinfo.xml file from the template - buildServerinfo(hostname, docroot) + buildServerinfo(hostname, authtype, docroot) elif args[0] == "remove": doToAccounts(removeUser) Modified: CalDAVTester/trunk/scripts/server/serverinfo-template.xml =================================================================== --- CalDAVTester/trunk/scripts/server/serverinfo-template.xml 2009-01-29 00:20:08 UTC (rev 3621) +++ CalDAVTester/trunk/scripts/server/serverinfo-template.xml 2009-01-29 17:48:12 UTC (rev 3622) @@ -21,7 +21,7 @@ <serverinfo> <host>%(hostname)s</host> <port>8008</port> - <authtype>basic</authtype> + <authtype>%(authtype)s</authtype> <substitutions> <substitution> <key>$host:</key> Modified: CalDAVTester/trunk/scripts/tests/acl.xml =================================================================== --- CalDAVTester/trunk/scripts/tests/acl.xml 2009-01-29 00:20:08 UTC (rev 3621) +++ CalDAVTester/trunk/scripts/tests/acl.xml 2009-01-29 17:48:12 UTC (rev 3622) @@ -1204,7 +1204,7 @@ </test> <test name='5' ignore='no'> <description>Bogus authenticated get on non-existent inaccessible resource</description> - <request user="admin" pswd="foobar"> + <request user="$useradmin:" pswd="foobar"> <method>GET</method> <ruri>$pathprefix1:/calendar-bogus/</ruri> <verify> @@ -1218,7 +1218,7 @@ </test> <test name='6' ignore='no'> <description>Bogus authenticated get on existing inaccessible resource</description> - <request user="admin" pswd="foobar"> + <request user="$useradmin:" pswd="foobar"> <method>GET</method> <ruri>$calendarpath1:/1.ics</ruri> <verify>