[CalendarServer-changes] [6028] CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore /test
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 10 08:22:06 PDT 2010
Revision: 6028
http://trac.macosforge.org/projects/calendarserver/changeset/6028
Author: sagen at apple.com
Date: 2010-08-10 08:22:06 -0700 (Tue, 10 Aug 2010)
Log Message:
-----------
Use StubNotifierFactory.compare( ) rather than _history; remove some now-unnecessary test hacks
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py
CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py 2010-08-10 15:20:05 UTC (rev 6027)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py 2010-08-10 15:22:06 UTC (rev 6028)
@@ -434,9 +434,10 @@
self.commit()
# Make sure notification fired after commit
- self.assertEquals(
- self.notifierFactory.history,
- [("update", "home1"), ("update", "home1"), ("update", "home1")]
+ self.assertTrue(
+ self.notifierFactory.compare(
+ [("update", "home1"), ("update", "home1"), ("update", "home1")]
+ )
)
@@ -536,16 +537,17 @@
# Make sure notifications are fired after commit
self.commit()
- self.assertEquals(
- self.notifierFactory.history,
- [
- ("update", "home1"),
- ("update", "home1/calendar_1"),
- ("update", "home1"),
- ("update", "home1/calendar_1"),
- ("update", "home1"),
- ("update", "home1/calendar_1"),
- ]
+ self.assertTrue(
+ self.notifierFactory.compare(
+ [
+ ("update", "home1"),
+ ("update", "home1/calendar_1"),
+ ("update", "home1"),
+ ("update", "home1/calendar_1"),
+ ("update", "home1"),
+ ("update", "home1/calendar_1"),
+ ]
+ )
)
def test_removeCalendarObjectWithName_exists(self):
@@ -697,12 +699,13 @@
self.commit()
# Make sure notifications fire after commit
- self.assertEquals(
- self.notifierFactory.history,
- [
- ("update", "home1"),
- ("update", "home1/calendar_1"),
- ]
+ self.assertTrue(
+ self.notifierFactory.compare(
+ [
+ ("update", "home1"),
+ ("update", "home1/calendar_1"),
+ ]
+ )
)
@@ -808,12 +811,13 @@
self.commit()
# Make sure notification fired after commit
- self.assertEquals(
- self.notifierFactory.history,
- [
- ("update", "home1"),
- ("update", "home1/calendar_1"),
- ]
+ self.assertTrue(
+ self.notifierFactory.compare(
+ [
+ ("update", "home1"),
+ ("update", "home1/calendar_1"),
+ ]
+ )
)
@@ -1099,8 +1103,11 @@
return Notifier(self, label=label, id=id)
def send(self, op, id):
- self.history.append((op, id))
+ self._history.append((op, id))
def reset(self):
- self.history = []
+ self._history = []
+ def compare(self, expected):
+ return self._history == expected
+
Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-10 15:20:05 UTC (rev 6027)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-10 15:22:06 UTC (rev 6028)
@@ -215,29 +215,18 @@
home = populateTxn.addressbookHomeWithUID(homeUID, True)
# We don't want the default addressbook to appear unless it's
# explicitly listed.
-
- # FIXME: why does this addressbook sometimes not exist?
- try:
- home.removeAddressBookWithName("addressbook")
- except NoSuchHomeChildError:
- pass
-
+ home.removeAddressBookWithName("addressbook")
for addressbookName in addressbooks:
addressbookObjNames = addressbooks[addressbookName]
if addressbookObjNames is not None:
+ home.createAddressBookWithName(addressbookName)
+ addressbook = home.addressbookWithName(addressbookName)
+ for objectName in addressbookObjNames:
+ objData = addressbookObjNames[objectName]
+ addressbook.createAddressBookObjectWithName(
+ objectName, VCard.fromString(objData)
+ )
- # FIXME: how can an addressbook already exist?
- try:
- home.createAddressBookWithName(addressbookName)
- addressbook = home.addressbookWithName(addressbookName)
- for objectName in addressbookObjNames:
- objData = addressbookObjNames[objectName]
- addressbook.createAddressBookObjectWithName(
- objectName, VCard.fromString(objData)
- )
- except HomeChildNameAlreadyExistsError:
- pass
-
populateTxn.commit()
self.notifierFactory.reset()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100810/fe33ea74/attachment-0001.html>
More information about the calendarserver-changes
mailing list