[CalendarServer-changes] [9908] CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/ datastore
source_changes at macosforge.org
source_changes at macosforge.org
Mon Oct 8 16:41:03 PDT 2012
Revision: 9908
http://trac.calendarserver.org//changeset/9908
Author: gaya at apple.com
Date: 2012-10-08 16:41:03 -0700 (Mon, 08 Oct 2012)
Log Message:
-----------
Add test_addressbookObjectUID -- that fails for now. Partially fix for txdav.carddav.datastore.sql.py.
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2012-10-08 23:05:51 UTC (rev 9907)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2012-10-08 23:41:03 UTC (rev 9908)
@@ -297,6 +297,7 @@
self._objectText = componentText
# ADDRESSBOOK_OBJECT table update
+ self._uid = component.resourceUID()
self._md5 = hashlib.md5(componentText).hexdigest()
self._size = len(componentText)
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py 2012-10-08 23:05:51 UTC (rev 9907)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py 2012-10-08 23:41:03 UTC (rev 9908)
@@ -304,14 +304,60 @@
yield d2
@inlineCallbacks
+ def test_addressbookObjectUID(self):
+ """
+ Test that kind property UID is stored correctly in database
+ """
+ addressbookStore = yield buildStore(self, self.notifierFactory)
+
+ # Provision the home and addressbook, one user and one group
+ txn = addressbookStore.newTransaction()
+ home = yield txn.homeWithUID(EADDRESSBOOKTYPE, "uid1", create=True)
+ self.assertNotEqual(home, None)
+ adbk = yield home.addressbookWithName("addressbook")
+ self.assertNotEqual(adbk, None)
+
+ person = VCard.fromString(
+ """BEGIN:VCARD
+VERSION:3.0
+N:Thompson;Default;;;
+FN:Default Thompson
+EMAIL;type=INTERNET;type=WORK;type=pref:lthompson at example.com
+TEL;type=WORK;type=pref:1-555-555-5555
+TEL;type=CELL:1-444-444-4444
+item1.ADR;type=WORK;type=pref:;;1245 Test;Sesame Street;California;11111;USA
+item1.X-ABADR:us
+UID:uid1
+END:VCARD
+""".replace("\n", "\r\n")
+ )
+ self.assertEqual(person.resourceUID(), "uid1")
+ abObject = yield adbk.createObjectResourceWithName("1.vcf", person)
+ self.assertEqual(abObject.uid(), "uid1")
+ yield txn.commit()
+
+ txn = addressbookStore.newTransaction()
+ home = yield txn.homeWithUID(EADDRESSBOOKTYPE, "uid1", create=True)
+ adbk = yield home.addressbookWithName("addressbook")
+
+ abObject = yield AddressBookObject.objectWithName(adbk, "1.vcf", "badUID")
+ self.assertEqual(abObject, None)
+
+ abObject = yield AddressBookObject.objectWithName(adbk, "1.vcf", "uid1")
+ person = yield abObject.component()
+ self.assertEqual(person.resourceUID(), "uid1")
+
+ abObject = yield AddressBookObject.objectWithName(adbk, "1.vcf", "badUID")
+ self.assertEqual(abObject, None)
+
+ yield txn.commit()
+
+
+ @inlineCallbacks
def test_addressbookObjectKind(self):
"""
Test that kind property vCard is stored correctly in database
"""
- """
- Test that two concurrent attempts to PUT different address book object resources to the
- same address book home does not cause a deadlock.
- """
addressbookStore = yield buildStore(self, self.notifierFactory)
# Provision the home and addressbook, one user and one group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121008/0c37acfc/attachment-0001.html>
More information about the calendarserver-changes
mailing list