[CalendarServer-changes] [10563] CalendarServer/branches/users/glyph/unshare-when-access-revoked
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jan 28 19:28:40 PST 2013
Revision: 10563
http://trac.calendarserver.org//changeset/10563
Author: glyph at apple.com
Date: 2013-01-28 19:28:40 -0800 (Mon, 28 Jan 2013)
Log Message:
-----------
Move inner classes to class scope, make it easier to read the sharing test, and remove commented-out duplicate sharing tests.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/unshare-when-access-revoked/
Modified: CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py
===================================================================
--- CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py 2013-01-29 03:27:34 UTC (rev 10562)
+++ CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py 2013-01-29 03:28:40 UTC (rev 10563)
@@ -35,6 +35,89 @@
sharedOwnerType = davxml.ResourceType.sharedownercalendar #@UndefinedVariable
regularCalendarType = davxml.ResourceType.calendar #@UndefinedVariable
+
+
+class StubCollection(object):
+
+ def __init__(self):
+ self._isShareeCollection = True
+ self._shareePrincipal = StubUserPrincipal()
+
+
+ def isCalendarCollection(self):
+ return True
+
+
+
+class StubShare(object):
+
+ def direct(self):
+ return True
+
+ def url(self):
+ return "/wikifoo"
+
+ def uid(self):
+ return "012345"
+
+ def shareeUID(self):
+ return StubUserPrincipal().record.guid
+
+
+
+class TestCollection(SharedCollectionMixin, StubCollection):
+ def principalForUID(self, uid):
+ principal = StubUserPrincipal()
+ return principal if principal.record.guid == uid else None
+
+
+
+class StubRecord(object):
+ def __init__(self, recordType, name, guid):
+ self.recordType = recordType
+ self.shortNames = [name]
+ self.guid = guid
+
+
+
+class StubUserPrincipal(object):
+ def __init__(self):
+ self.record = StubRecord(
+ "users",
+ "testuser",
+ "4F364813-0415-45CB-9FD4-DBFEF7A0A8E0"
+ )
+
+
+ def principalURL(self):
+ return "/principals/__uids__/%s/" % (self.record.guid,)
+
+
+
+class StubWikiPrincipal(object):
+ def __init__(self):
+ self.record = StubRecord(
+ WikiDirectoryService.recordType_wikis,
+ "wikifoo",
+ "foo"
+ )
+
+class StubWikiResource(object):
+ implements(IResource)
+
+ def locateChild(self, req, segments):
+ pass
+
+
+ def renderHTTP(self, req):
+ pass
+
+
+ def ownerPrincipal(self, req):
+ return succeed(StubWikiPrincipal())
+
+
+
class SharingTests(HomeTestCase):
class FakePrincipal(object):
@@ -607,69 +690,6 @@
def stubWikiAccessMethod(userID, wikiID):
return access
- class StubCollection(object):
- def __init__(self):
- self._isShareeCollection = True
- self._shareePrincipal = StubUserPrincipal()
- def isCalendarCollection(self):
- return True
-
- class StubShare(object):
- def direct(self):
- return True
-
- def url(self):
- return "/wikifoo"
-
- def uid(self):
- return "012345"
-
- def shareeUID(self):
- return StubUserPrincipal().record.guid
-
- class TestCollection(SharedCollectionMixin, StubCollection):
- def principalForUID(self, uid):
- principal = StubUserPrincipal()
- return principal if principal.record.guid == uid else None
-
- class StubRecord(object):
- def __init__(self, recordType, name, guid):
- self.recordType = recordType
- self.shortNames = [name]
- self.guid = guid
-
- class StubUserPrincipal(object):
- def __init__(self):
- self.record = StubRecord(
- "users",
- "testuser",
- "4F364813-0415-45CB-9FD4-DBFEF7A0A8E0"
- )
- def principalURL(self):
- return "/principals/__uids__/%s/" % (self.record.guid,)
-
- class StubWikiPrincipal(object):
- def __init__(self):
- self.record = StubRecord(
- WikiDirectoryService.recordType_wikis,
- "wikifoo",
- "foo"
- )
-
- class StubWikiResource(object):
- implements(IResource)
-
- def locateChild(self, req, segments):
- pass
-
-
- def renderHTTP(self, req):
- pass
-
-
- def ownerPrincipal(self, req):
- return succeed(StubWikiPrincipal())
-
collection = TestCollection()
collection._share = StubShare()
self.site.resource.putChild("wikifoo", StubWikiResource())
@@ -687,16 +707,6 @@
self.assertTrue("<write/>" in acl.toxml())
-'''
-class DatabaseSharingTests(SharingTests):
- @inlineCallbacks
- def setUp(self):
- self.calendarStore = yield buildStore(self, StubNotifierFactory())
- yield super(DatabaseSharingTests, self).setUp()
- def createDataStore(self):
- return self.calendarStore
-
-'''
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130128/38f161c3/attachment.html>
More information about the calendarserver-changes
mailing list