Esempio n. 1
0
 def test_migrateAddressbookFromFile(self):
     """
     C{_migrateAddressbook()} can migrate a file-backed addressbook to a
     database- backed addressbook.
     """
     fromAddressbook = yield self.fileTransaction().addressbookHomeWithUID(
         "home1").addressbookWithName("addressbook")
     toHome = yield self.transactionUnderTest().addressbookHomeWithUID(
         "new-home", create=True)
     toAddressbook = yield toHome.addressbookWithName("addressbook")
     yield _migrateAddressbook(fromAddressbook, toAddressbook,
                               lambda x: x.component())
     yield self.assertAddressbooksSimilar(fromAddressbook, toAddressbook)
Esempio n. 2
0
 def test_migrateAddressbookFromFile(self):
     """
     C{_migrateAddressbook()} can migrate a file-backed addressbook to a
     database- backed addressbook.
     """
     fromAddressbook = yield self.fileTransaction().addressbookHomeWithUID(
         "home1").addressbookWithName("addressbook")
     toHome = yield self.transactionUnderTest().addressbookHomeWithUID(
         "new-home", create=True)
     toAddressbook = yield toHome.addressbookWithName("addressbook")
     yield _migrateAddressbook(fromAddressbook, toAddressbook,
                               lambda x: x.component())
     yield self.assertAddressbooksSimilar(fromAddressbook, toAddressbook)
Esempio n. 3
0
 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")
     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)
Esempio n. 4
0
 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")
     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)