[CalendarServer-changes] [9525] CalendarServer/branches/users/gaya/inviteclean
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 3 16:35:58 PDT 2012
Revision: 9525
http://trac.macosforge.org/projects/calendarserver/changeset/9525
Author: gaya at apple.com
Date: 2012-08-03 16:35:56 -0700 (Fri, 03 Aug 2012)
Log Message:
-----------
fix tests used sharesDB
Modified Paths:
--------------
CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py
CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/test_sql.py
Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py 2012-08-03 20:52:41 UTC (rev 9524)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py 2012-08-03 23:35:56 UTC (rev 9525)
@@ -1117,31 +1117,6 @@
share = Share(shareeHomeChild=shareeHomeChild, sharerHomeChild=sharerHomeChild, url=url)
shares.append(share)
- # DEBUG ONLY
- '''
- shares.sort(key=lambda share:share.uid())
-
- allRecords = yield self.sharesDB().allRecords()
- allRecords.sort(key=lambda record:record.shareuid)
-
- oTestStrings = []
- for i in range(len(allRecords)):
- record = allRecords[i]
- testStr = "i=%s, shareuid=%s, sharetype=%s, hostulr=%s, localname=%s, summary=%s" % (i, record.shareuid, record.sharetype, record.hosturl, record.localname, record.summary, )
- oTestStrings += [testStr,]
-
- testStrings = []
- for i in range(len(shares)):
- share = shares[i]
- testStr = "i=%s, shareuid=%s, sharetype=%s, hostulr=%s, localname=%s, summary=%s" % (i, share.uid(), "D" if share.direct() else "I", share.url(), share.name(), share.summary(), )
- testStrings += [testStr,]
-
- if oTestStrings != testStrings:
- print("MISMATCH old: %s" % oTestStrings)
- print("MISMATCH new: %s" % testStrings)
- assert False
- '''
-
self._allShares = dict([(share.name(), share) for share in shares])
returnValue(self._allShares)
Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py 2012-08-03 20:52:41 UTC (rev 9524)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py 2012-08-03 23:35:56 UTC (rev 9525)
@@ -1004,13 +1004,6 @@
(yield
(yield normalCal.calendarObjectWithName("1.ics")).component())
)
- # Check legacy shares database too, since that's what the protocol layer
- # is still using to list things.
- self.assertEqual(
- [(record.shareuid, record.localname) for record in
- (yield otherHome.retrieveOldShares().allRecords())],
- [(newCalName, newCalName)]
- )
@inlineCallbacks
@@ -1051,8 +1044,6 @@
self.assertIdentical(otherCal, None)
invitedCals = yield cal.asShared()
self.assertEqual(len(invitedCals), 0)
- shares = yield other.retrieveOldShares().allRecords()
- self.assertEqual(len(shares), 0)
@inlineCallbacks
def test_unshareSharerSide(self, commit=False):
@@ -1072,8 +1063,6 @@
self.assertEqual(otherCal, None)
invitedCals = yield cal.asShared()
self.assertEqual(len(invitedCals), 0)
- shares = yield other.retrieveOldShares().allRecords()
- self.assertEqual(len(shares), 0)
@inlineCallbacks
def test_unshareShareeSide(self, commit=False):
@@ -1093,8 +1082,6 @@
self.assertEqual(otherCal, None)
invitedCals = yield cal.asShared()
self.assertEqual(len(invitedCals), 0)
- shares = yield other.retrieveOldShares().allRecords()
- self.assertEqual(len(shares), 0)
@inlineCallbacks
def test_unshareWithInDifferentTransaction(self):
@@ -1156,8 +1143,12 @@
"uid2-5", object, "schedule"
))
self.assertFalse(result)
+ yield None
+ test_hasCalendarResourceUIDSomewhereElse.todo = (
+ "stubbed out, not sure how to implement without legacy db")
+
@inlineCallbacks
def test_getCalendarResourcesForUID(self):
"""
Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/test_sql.py 2012-08-03 20:52:41 UTC (rev 9524)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/test_sql.py 2012-08-03 23:35:56 UTC (rev 9525)
@@ -46,7 +46,6 @@
from twistedcaldav.dateops import datetimeMktime
from twistedcaldav.ical import Component
from twistedcaldav.query import calendarqueryfilter
-from twistedcaldav.sharing import SharedCollectionRecord
import datetime
from pycalendar.datetime import PyCalendarDateTime
@@ -914,38 +913,40 @@
# Provision the home and calendar now
txn = calendarStore.newTransaction()
- home = yield txn.homeWithUID(ECALENDARTYPE, "uid1", create=True)
- self.assertNotEqual(home, None)
- cal = yield home.calendarWithName("calendar")
+ sharerHome = yield txn.homeWithUID(ECALENDARTYPE, "uid1", create=True)
+ self.assertNotEqual(sharerHome, None)
+ cal = yield sharerHome.calendarWithName("calendar")
self.assertNotEqual(cal, None)
+ shareeHome = yield txn.homeWithUID(ECALENDARTYPE, "uid2", create=True)
+ self.assertNotEqual(shareeHome, None)
yield txn.commit()
txn1 = calendarStore.newTransaction()
txn2 = calendarStore.newTransaction()
- home1 = yield txn1.homeWithUID(ECALENDARTYPE, "uid1", create=True)
- home2 = yield txn2.homeWithUID(ECALENDARTYPE, "uid1", create=True)
+ sharerHome1 = yield txn1.homeWithUID(ECALENDARTYPE, "uid1", create=True)
+ self.assertNotEqual(sharerHome1, None)
+ cal1 = yield sharerHome1.calendarWithName("calendar")
+ self.assertNotEqual(cal1, None)
+ shareeHome1 = yield txn1.homeWithUID(ECALENDARTYPE, "uid2", create=True)
+ self.assertNotEqual(shareeHome1, None)
- shares1 = yield home1.retrieveOldShares()
- shares2 = yield home2.retrieveOldShares()
+ sharerHome2 = yield txn2.homeWithUID(ECALENDARTYPE, "uid1", create=True)
+ self.assertNotEqual(sharerHome2, None)
+ cal2 = yield sharerHome2.calendarWithName("calendar")
+ self.assertNotEqual(cal2, None)
+ shareeHome2 = yield txn1.homeWithUID(ECALENDARTYPE, "uid2", create=True)
+ self.assertNotEqual(shareeHome2, None)
- record = SharedCollectionRecord(
- "abcd",
- "D",
- "/calendars/__uids__/uid2/calendar/",
- "XYZ",
- "Shared Wiki Calendar",
- )
-
@inlineCallbacks
def _defer1():
- yield shares1.addOrUpdateRecord(record)
+ yield cal1.shareWith(shareeHome=sharerHome1, mode=_BIND_MODE_DIRECT, status=_BIND_STATUS_ACCEPTED, message="Shared Wiki Calendar")
yield txn1.commit()
d1 = _defer1()
@inlineCallbacks
def _defer2():
- yield shares2.addOrUpdateRecord(record)
+ yield cal2.shareWith(shareeHome=sharerHome2, mode=_BIND_MODE_DIRECT, status=_BIND_STATUS_ACCEPTED, message="Shared Wiki Calendar")
yield txn2.commit()
d2 = _defer2()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120803/76e637bc/attachment.html>
More information about the calendarserver-changes
mailing list