Skip to content
Permalink
Browse files

Make sure unit tests use the same dropbox template URI as we use in t…

…he real server.

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk@14972 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information...
cyrusdaboo committed Jul 16, 2015
1 parent 924d4bc commit 72d2d89b7121092e80aca04583f471d9109cda84
@@ -413,7 +413,7 @@ def doImplicitAttendeeUpdate(self):
log.debug("ImplicitProcessing - originator '%s' to recipient '%s' ignoring UID: '%s' - split already done" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid))
returnValue((True, False, False, None,))
else:
self.message.removeProperty("X-CALENDARSERVER-SPLIT-OLDER-UID")
self.message.removeProperty("X-CALENDARSERVER-SPLIT-NEWER-UID")
self.message.removeProperty("X-CALENDARSERVER-SPLIT-RID")

# Different based on method
@@ -2629,7 +2629,7 @@ def __init__(self, calendar, name, uid, resourceID=None, options=None):
self.scheduleTag = options.get("scheduleTag", "")
self.scheduleEtags = options.get("scheduleEtags", "")
self.hasPrivateComment = options.get("hasPrivateComment", False)
self._dropboxID = None
self._dropboxID = options.get("dropboxID", None)

# Component caching
self._cachedComponent = None
@@ -5310,6 +5310,7 @@ def split(self, onlyThis=False, rid=None, olderUID=None, coercePartstatsInExisti
olderResourceName,
calendar_old,
ComponentUpdateState.SPLIT_OWNER,
options={"dropboxID": olderUID},
split_details=(rid, newerUID, False, False)
)

@@ -5368,7 +5369,12 @@ def splitForAttendee(self, rid=None, olderUID=None, coercePartstatsInExistingRes

# Create a new resource and store its data (but not if the parent is "inbox", or if it is empty)
if not self.calendar().isInbox() and ical_old.mainType() is not None:
olderObject = yield self.calendar()._createCalendarObjectWithNameInternal("{0}.ics".format(olderUID,), ical_old, ComponentUpdateState.SPLIT_ATTENDEE)
olderObject = yield self.calendar()._createCalendarObjectWithNameInternal(
"{0}.ics".format(olderUID,),
ical_old,
ComponentUpdateState.SPLIT_ATTENDEE,
options={"dropboxID": olderUID},
)

# Reconcile trash state
if self.isInTrash():
@@ -1689,7 +1689,7 @@ def _verifyConversion(self, home, calendar, event, filenames):
for attach in attachments:
if attach.hasParameter("MANAGED-ID"):
managed_count += 1
self.assertTrue(attach.value().find("/dropbox/") == -1)
self.assertTrue(attach.value().find("/dropbox/") != -1)
self.assertTrue(attach.parameterValue("FILENAME") in filenames)
else:
dropbox_count += 1
@@ -1867,7 +1867,7 @@ def test_convertAttachments(self):
for attach in attachments:
if attach.hasParameter("MANAGED-ID"):
managed_count += 1
self.assertTrue(attach.value().find("1.2.dropbox") == -1)
self.assertTrue(attach.value().find("1.2.dropbox") != -1)
self.assertEqual(attach.parameterValue("MANAGED-ID"), mnew.managedID())
self.assertEqual(attach.parameterValue("FILENAME"), mnew.name())
else:
@@ -1905,7 +1905,7 @@ def test_convertAttachments(self):
for attach in attachments:
if attach.hasParameter("MANAGED-ID"):
managed_count += 1
self.assertTrue(attach.value().find("1.2.dropbox") == -1)
self.assertTrue(attach.value().find("1.2.dropbox") != -1)
self.assertTrue(attach.parameterValue("FILENAME") in ("attach_1_2_1.txt", "attach_1_2_2.txt"))
else:
dropbox_count += 1
@@ -5355,6 +5355,7 @@ def test_calendarObjectSplit_attachments(self):
self.assertEqual(attachment.value(), location)

relsubs["past_mid"] = attachment.parameterValue("MANAGED-ID")
attachment = ical_past.masterComponent().getProperty("ATTACH")
relsubs["att_past_uri"] = attachment.value()

# Verify user01 data
@@ -976,7 +976,7 @@ def test_add_attachment(self):
from txdav.caldav.datastore.sql_external import ManagedAttachmentExternal
self.assertTrue(isinstance(attachment, ManagedAttachmentExternal))
self.assertEqual(attachment.size(), len(data))
self.assertTrue("user01/attachments/test" in location)
self.assertTrue("user01/dropbox/" in location)
yield self.commitTransaction(1)

cobjs = yield ManagedAttachment.referencesTo(self.theTransactionUnderTest(0), managedID)
@@ -1013,7 +1013,7 @@ def test_update_attachment(self):
from txdav.caldav.datastore.sql_external import ManagedAttachmentExternal
self.assertTrue(isinstance(attachment, ManagedAttachmentExternal))
self.assertEqual(attachment.size(), len(data))
self.assertTrue("user01/attachments/test" in location)
self.assertTrue("user01/dropbox/" in location)
yield self.commitTransaction(1)

cobjs = yield ManagedAttachment.referencesTo(self.theTransactionUnderTest(0), managedID)
@@ -260,10 +260,7 @@ def makeAndCleanStore(
{"push": notifierFactory} if notifierFactory is not None else {},
directoryService,
attachmentRoot,
(
"https://example.com/calendars/__uids__/"
"%(home)s/attachments/%(name)s"
),
"https://example.com/calendars/__uids__/%(home)s/dropbox/%(dropbox_id)s/%(name)s",
quota=quota
)
store.label = currentTestID

0 comments on commit 72d2d89

Please sign in to comment.
You can’t perform that action at this time.