Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Extension to unit tests that demonstrates bug in migration code #487

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1285,11 +1285,13 @@ def populate(self):
}

@inlineCallbacks
def _createShare(self, shareFrom, shareTo, accept=True):
def _createShare(self, shareFrom, shareTo, accept=True, name="calendar"):
# Invite
txnindex = 1 if shareFrom[0] == "p" else 0
home = yield self.homeUnderTest(txn=self.theTransactionUnderTest(txnindex), name=shareFrom, create=True)
calendar = yield home.childWithName("calendar")
if name != "calendar":
yield home.createChildWithName(name)
calendar = yield home.childWithName(name)
shareeView = yield calendar.inviteUIDToShare(shareTo, _BIND_MODE_READ, "summary")
yield self.commitTransaction(txnindex)

Expand Down Expand Up @@ -1323,6 +1325,7 @@ def test_shared_collections_reconcile(self):

# Shared to migrating user
shared_name_04 = yield self._createShare("user04", "user01")
shared_name_04a = yield self._createShare("user04", "user01", True, "shared")
shared_name_05 = yield self._createShare("puser05", "user01")

# Sync from remote side
Expand All @@ -1333,7 +1336,7 @@ def test_shared_collections_reconcile(self):
changes = yield syncer.sharedByCollectionsReconcile()
self.assertEqual(changes, 2)
changes = yield syncer.sharedToCollectionsReconcile()
self.assertEqual(changes, 2)
self.assertEqual(changes, 3)

# Local calendar exists with shares
home1 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(1), name="user01", status=_HOME_STATUS_MIGRATING)
Expand Down