[CalendarServer-changes] [7608] CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/ test/common.py

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


Revision: 7608
          http://trac.macosforge.org/projects/calendarserver/changeset/7608
Author:   glyph at apple.com
Date:     2011-06-20 11:42:34 -0700 (Mon, 20 Jun 2011)
Log Message:
-----------
failing test for quota exceeded

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.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:42:22 UTC (rev 7607)
+++ CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py	2011-06-20 18:42:34 UTC (rev 7608)
@@ -1592,6 +1592,7 @@
         return self.createAttachmentTest(refresh)
 
 
+    @inlineCallbacks
     def test_exceedQuota(self):
         """
         If too many bytes are passed to the transport returned by
@@ -1599,17 +1600,21 @@
         L{IAttachmentStorageTransport.loseConnection} will return a L{Deferred}
         that fails with L{QuotaExceeded}.
         """
+        home = yield self.homeUnderTest()
         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()
+        sample = "all work and no play makes jack a dull boy"
 
+        t.write(sample * (1 + (home.quotaAllowedBytes() /
+                          len(sample))))
 
+        d = t.loseConnection()
+        yield self.failUnlessFailure(d, QuotaExceeded)
+
+
     def test_removeAttachmentWithName(self, refresh=lambda x:x):
         """
         L{ICalendarObject.removeAttachmentWithName} will remove the calendar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110620/e6414321/attachment-0001.html>


More information about the calendarserver-changes mailing list