[CalendarServer-changes] [8047] CalendarServer/trunk/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 2 13:04:21 PDT 2011
Revision: 8047
http://trac.macosforge.org/projects/calendarserver/changeset/8047
Author: cdaboo at apple.com
Date: 2011-09-02 13:04:19 -0700 (Fri, 02 Sep 2011)
Log Message:
-----------
Tweak tests.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
CalendarServer/trunk/txdav/carddav/datastore/test/common.py
CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
Added Paths:
-----------
CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/
CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/
CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/1.vcf
CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/2.vcf
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2011-09-02 18:44:56 UTC (rev 8046)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2011-09-02 20:04:19 UTC (rev 8047)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2010 Apple Inc. All rights reserved.
+# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -156,7 +156,8 @@
def test_migrateBadCalendarFromFile(self):
"""
C{_migrateCalendar()} can migrate a file-backed calendar to a database-
- backed calendar.
+ backed calendar. We need to test what happens when there is "bad" calendar data
+ present in the file-backed calendar.
"""
fromCalendar = yield (yield self.fileTransaction().calendarHomeWithUID(
"home_bad")).calendarWithName("calendar_bad")
Added: CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/1.vcf
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/1.vcf (rev 0)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/1.vcf 2011-09-02 20:04:19 UTC (rev 8047)
@@ -0,0 +1,2 @@
+BEGIN:VCARD
+END:VCARD
Added: CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/2.vcf
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/2.vcf (rev 0)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_bad/addressbook_bad/2.vcf 2011-09-02 20:04:19 UTC (rev 8047)
@@ -0,0 +1,17 @@
+BEGIN:VCARD
+VERSION:3.0
+N:Contact;Mulberry;;;
+FN:Mulberry Contact
+NICKNAME:mulberry
+ORG:Apple Inc.;
+EMAIL;type=INTERNET;type=WORK;type=pref:mulberry at example.com
+TEL;type=HOME;type=pref:777-777-7777
+TEL;type=WORK:8888888888
+TEL;type=WORK;type=FAX:5555555555
+item1.ADR;type=WORK;type=pref:;;1234 Infinite Circle;Exampletino\, CA 99999;USA;;
+item1.X-ABADR:us
+NOTE:This is a contact created in Mulberry.
+item2.URL;type=pref:http://www.example.com/~magic
+item2.X-ABLabel:_$!<HomePage>!$_
+UID:uid2
+END:VCARD
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/common.py 2011-09-02 18:44:56 UTC (rev 8046)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/common.py 2011-09-02 20:04:19 UTC (rev 8047)
@@ -1,6 +1,6 @@
# -*- test-case-name: txdav.carddav.datastore,txdav.carddav.datastore.test.test_sql.AddressBookSQLStorageTests -*-
##
-# Copyright (c) 2010 Apple Inc. All rights reserved.
+# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -981,6 +981,7 @@
uid for uid in self.requirements
if self.requirements[uid] is not None
])
+ additionalUIDs.add("home_bad")
expectedUIDs = additionalUIDs.union(requiredUIDs)
self.assertEquals(foundUIDs, expectedUIDs)
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2011-09-02 18:44:56 UTC (rev 8046)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2011-09-02 20:04:19 UTC (rev 8047)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2010 Apple Inc. All rights reserved.
+# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -147,6 +147,24 @@
@inlineCallbacks
+ def test_migrateBadAddressbookFromFile(self):
+ """
+ C{_migrateAddressbook()} can migrate a file-backed addressbook to a
+ database-backed addressbook. We need to test what happens when there
+ is "bad" address data present in the file-backed addressbook.
+ """
+ fromAddressbook = yield self.fileTransaction().addressbookHomeWithUID(
+ "home_bad").addressbookWithName("addressbook_bad")
+ toHome = yield self.transactionUnderTest().addressbookHomeWithUID(
+ "new-home", create=True)
+ toAddressbook = yield toHome.addressbookWithName("addressbook")
+ ok, bad = (yield _migrateAddressbook(fromAddressbook, toAddressbook,
+ lambda x: x.component()))
+ self.assertEqual(ok, 1)
+ self.assertEqual(bad, 1)
+
+
+ @inlineCallbacks
def test_migrateHomeFromFile(self):
"""
L{migrateHome} will migrate an L{IAddressbookHome} provider from one
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110902/b8a14e07/attachment.html>
More information about the calendarserver-changes
mailing list