[CalendarServer-changes] [7617] 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:44:13 PDT 2011
Revision: 7617
http://trac.macosforge.org/projects/calendarserver/changeset/7617
Author: glyph at apple.com
Date: 2011-06-20 11:44:13 -0700 (Mon, 20 Jun 2011)
Log Message:
-----------
The SQL implementation is a bit over-zealous, removing attachments when quota is
exceeded even if there was a previous version. Test to make sure that doesn't
happen.
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:44:02 UTC (rev 7616)
+++ CalendarServer/branches/users/glyph/quota/txdav/caldav/datastore/test/common.py 2011-06-20 18:44:13 UTC (rev 7617)
@@ -1642,11 +1642,24 @@
t.write(sampleData)
yield t.loseConnection()
yield self.exceedQuotaTest(get)
- catch = StringIO()
- catch.dataReceived = catch.write
- catch.connectionLost = lambda reason: None
- attachment.retrieve(catch)
- self.assertEquals(catch.getvalue()[:60], sampleData)
+ def checkOriginal():
+ catch = StringIO()
+ catch.dataReceived = catch.write
+ lost = []
+ catch.connectionLost = lost.append
+ attachment.retrieve(catch)
+ expected = sampleData
+ # note: 60 is less than len(expected); trimming is just to make
+ # the error message look sane when the test fails.
+ actual = catch.getvalue()[:60]
+ self.assertEquals(actual, expected)
+ checkOriginal()
+ yield self.commit()
+ # Make sure that things go back to normal after a commit of that
+ # transaction.
+ obj = yield self.calendarObjectUnderTest()
+ attachment = yield get()
+ checkOriginal()
def test_removeAttachmentWithName(self, refresh=lambda x:x):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110620/8d5fa28e/attachment.html>
More information about the calendarserver-changes
mailing list