[CalendarServer-changes] [7606] CalendarServer/branches/users/glyph/quota/txdav/caldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jun 20 11:42:11 PDT 2011


Revision: 7606
          http://trac.macosforge.org/projects/calendarserver/changeset/7606
Author:   glyph at apple.com
Date:     2011-06-20 11:42:11 -0700 (Mon, 20 Jun 2011)
Log Message:
-----------
A bit more interface shuffling

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py
    CalendarServer/branches/users/glyph/quota/txdav/caldav/icalendarstore.py

Modified: CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py	2011-06-20 18:41:45 UTC (rev 7605)
+++ CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py	2011-06-20 18:42:11 UTC (rev 7606)
@@ -49,6 +49,8 @@
 
 
 from twistedcaldav.customxml import InviteNotification, InviteSummary
+from txdav.caldav.icalendarstore import IAttachmentStorageTransport
+from txdav.caldav.icalendarstore import QuotaExceeded
 from twistedcaldav.ical import Component
 
 storePath = FilePath(__file__).parent().child("calendar_store")
@@ -1535,6 +1537,7 @@
             "new.attachment",
         )
         t = attachment.store(MimeType("text", "x-fixture"))
+        self.assertProvides(IAttachmentStorageTransport, t)
         t.write("new attachment")
         t.write(" text")
         yield t.loseConnection()
@@ -1585,6 +1588,24 @@
         return self.createAttachmentTest(refresh)
 
 
+    def test_exceedQuota(self):
+        """
+        If too many bytes are passed to the transport returned by
+        L{ICalendarObject.createAttachmentWithName},
+        L{IAttachmentStorageTransport.loseConnection} will return a L{Deferred}
+        that fails with L{QuotaExceeded}.
+        """
+        obj = yield self.calendarObjectUnderTest()
+        attachment = yield obj.createAttachmentWithName(
+            "too-big.attachment",
+        )
+        t = attachment.store(MimeType("text", "x-fixture"))
+        self.assertProvides(IAttachmentStorageTransport, t)
+        t.write("new attachment")
+        t.write(" text")
+        yield t.loseConnection()
+
+
     def test_removeAttachmentWithName(self, refresh=lambda x:x):
         """
         L{ICalendarObject.removeAttachmentWithName} will remove the calendar
@@ -1648,7 +1669,7 @@
         yield self.calendarObjectUnderTest()
         txn = self.lastTransaction
         yield self.commit()
-        
+
         yield self.failUnlessFailure(
             maybeDeferred(txn.commit),
             AlreadyFinishedError

Modified: CalendarServer/branches/users/glyph/quota/txdav/caldav/icalendarstore.py
===================================================================
--- CalendarServer/branches/users/glyph/quota/txdav/caldav/icalendarstore.py	2011-06-20 18:41:45 UTC (rev 7605)
+++ CalendarServer/branches/users/glyph/quota/txdav/caldav/icalendarstore.py	2011-06-20 18:42:11 UTC (rev 7606)
@@ -176,9 +176,21 @@
         """
 
 
+    def quotaAllowedBytes():
+        """
+        The number of bytes of quota that the user is allowed to access.
+
+        Currently this is only enforced / tracked against attachment data.
+
+        @rtype: C{int}
+        """
+
+
     def quotaUsedBytes():
         """
         The number of bytes counted towards the user's quota.
+
+        @rtype: C{int}
         """
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110620/392e1d0c/attachment.html>


More information about the calendarserver-changes mailing list