[CalendarServer-changes] [13011] CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ directory/test/test_guidchange.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 27 11:03:46 PDT 2014


Revision: 13011
          http://trac.calendarserver.org//changeset/13011
Author:   sagen at apple.com
Date:     2014-03-27 11:03:46 -0700 (Thu, 27 Mar 2014)
Log Message:
-----------
Removing old test

Removed Paths:
-------------
    CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_guidchange.py

Deleted: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_guidchange.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_guidchange.py	2014-03-27 17:56:23 UTC (rev 13010)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_guidchange.py	2014-03-27 18:03:46 UTC (rev 13011)
@@ -1,116 +0,0 @@
-##
-# Copyright (c) 2005-2014 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-from __future__ import print_function
-
-from twistedcaldav.directory.directory import DirectoryService
-
-from txdav.xml import element as davxml
-from txweb2.dav.resource import AccessDeniedError
-from txweb2.test.test_server import SimpleRequest
-
-from twistedcaldav.directory.test.util import maybeCommit
-from twistedcaldav.test.util import TestCase, xmlFile
-
-
-class ProvisionedPrincipals(TestCase):
-    """
-    Directory service provisioned principals.
-    """
-    def setUp(self):
-        super(ProvisionedPrincipals, self).setUp()
-
-        # Setup the initial directory
-        self.createStockDirectoryService()
-        self.setupCalendars()
-
-        self.site.resource.setAccessControlList(davxml.ACL())
-
-
-    def resetCalendars(self):
-        del self.site.resource.putChildren["calendars"]
-        self.setupCalendars()
-
-
-    def test_guidchange(self):
-        """
-        DirectoryPrincipalResource.proxies()
-        """
-        oldUID = "5A985493-EE2C-4665-94CF-4DFEA3A89500"
-        newUID = "38D8AC00-5490-4425-BE3A-05FFB9862444"
-
-        homeResource = "/calendars/users/cdaboo/"
-
-        def privs1(result):
-            # Change GUID in record
-            self.xmlFile.setContent(
-                xmlFile.getContent().replace(oldUID, newUID)
-            )
-
-            # Force re-read of records (not sure why _fileInfo has to be wiped here...)
-            self.directoryService._fileInfo = (0, 0)
-            self.directoryService.recordWithShortName(DirectoryService.recordType_users, "cdaboo")
-
-            # Now force the calendar home resource to be reset
-            self.resetCalendars()
-
-            # Make sure new user cannot access old user's calendar home
-            return self._checkPrivileges(None, homeResource, davxml.HRef("/principals/__uids__/" + newUID + "/"), davxml.Write, False)
-
-        # Make sure current user has access to their calendar home
-        d = self._checkPrivileges(None, homeResource, davxml.HRef("/principals/__uids__/" + oldUID + "/"), davxml.Write, True)
-        d.addCallback(privs1)
-        return d
-
-    #
-    # This test fails because /calendars/users/cdaboo/ actually is a
-    # different resource (ie. the /calendars/__uids__/... URL would be
-    # different) when the GUID for cdaboo changes.
-    #
-    # The test needs to create a fixed resource with access granted to
-    # the old cdaboo; calendar homes no longer do this.
-    #
-    # Using the __uids__ URL won't work either because the old URL
-    # goes away with the old account.
-    #
-    test_guidchange.todo = "Test no longer works."
-
-    def _checkPrivileges(self, resource, url, principal, privilege, allowed):
-        request = SimpleRequest(self.site, "GET", "/")
-
-        def gotResource(resource):
-            d = resource.checkPrivileges(request, (privilege,), principal=davxml.Principal(principal))
-            if allowed:
-                def onError(f):
-                    f.trap(AccessDeniedError)
-                    #print(resource.readDeadProperty(davxml.ACL).toxml())
-                    self.fail("%s should have %s privilege on %r" % (principal, privilege.sname(), resource))
-                d.addErrback(onError)
-            else:
-                def onError(f):
-                    f.trap(AccessDeniedError)
-                def onSuccess(_):
-                    #print(resource.readDeadProperty(davxml.ACL).toxml())
-                    self.fail("%s should not have %s privilege on %r" % (principal, privilege.sname(), resource))
-                d.addCallback(onSuccess)
-                d.addErrback(onError)
-            def _commit(ignore):
-                maybeCommit(request)
-            d.addBoth(_commit)
-            return d
-
-        d = request.locateResource(url)
-        d.addCallback(gotResource)
-        return d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140327/b1e4cf86/attachment.html>


More information about the calendarserver-changes mailing list