[CalendarServer-changes] [6076] CalendarServer/trunk/txcaldav/calendarstore
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 13 09:51:36 PDT 2010
Revision: 6076
http://trac.macosforge.org/projects/calendarserver/changeset/6076
Author: glyph at apple.com
Date: 2010-08-13 09:51:35 -0700 (Fri, 13 Aug 2010)
Log Message:
-----------
tests for sufficient where-clause strictness on home->calendar and calendar->object steps
Modified Paths:
--------------
CalendarServer/trunk/txcaldav/calendarstore/postgres.py
CalendarServer/trunk/txcaldav/calendarstore/test/common.py
Modified: CalendarServer/trunk/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-12 20:55:22 UTC (rev 6075)
+++ CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-13 16:51:35 UTC (rev 6076)
@@ -1166,8 +1166,8 @@
"""
data = self._txn.execSQL(
"select CALENDAR_RESOURCE_ID from CALENDAR_BIND where "
- "CALENDAR_RESOURCE_NAME = %s",
- [name]
+ "CALENDAR_RESOURCE_NAME = %s and CALENDAR_HOME_RESOURCE_ID = %s",
+ [name, self._resourceID]
)
if not data:
return None
Modified: CalendarServer/trunk/txcaldav/calendarstore/test/common.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/common.py 2010-08-12 20:55:22 UTC (rev 6075)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/common.py 2010-08-13 16:51:35 UTC (rev 6076)
@@ -1087,7 +1087,37 @@
self.assertRaises(AlreadyFinishedError, txn.abort)
+ def test_dontLeakCalendars(self):
+ """
+ Calendars in one user's calendar home should not show up in another
+ user's calendar home.
+ """
+ home2 = self.transactionUnderTest().calendarHomeWithUID(
+ "home2", create=True)
+ self.assertIdentical(home2.calendarWithName("calendar_1"), None)
+
+ def test_dontLeakObjects(self):
+ """
+ Calendar objects in one user's calendar should not show up in another
+ user's via uid or name queries.
+ """
+ home1 = self.homeUnderTest()
+ home2 = self.transactionUnderTest().calendarHomeWithUID(
+ "home2", create=True)
+ calendar1 = home1.calendarWithName("calendar_1")
+ calendar2 = home2.calendarWithName("calendar")
+ objects = list(home2.calendarWithName("calendar").calendarObjects())
+ self.assertEquals(objects, [])
+ for resourceName in self.requirements['home1']['calendar_1'].keys():
+ obj = calendar1.calendarObjectWithName(resourceName)
+ self.assertIdentical(
+ calendar2.calendarObjectWithName(resourceName), None)
+ self.assertIdentical(
+ calendar2.calendarObjectWithUID(obj.uid()), None)
+
+
+
class StubNotifierFactory(object):
""" For testing push notifications without an XMPP server """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100813/d622fddf/attachment.html>
More information about the calendarserver-changes
mailing list