示例#1
0
    def testComplexMigration(self):
        migration.register(ComplexMigration(type_name=VersionedTest2.type_name,
                                            source_ver=1, target_ver=2))

        serialization.register(VersionedTest2)
        doc = yield self.connection.save_document(VersionedTest1())
        self.assertEqual('default', doc.field1)

        yield tools.migration_script(self.connection)
        self.assertTrue(self.run)

        doc = yield self.connection.get_document('testdoc')
        self.assertEqual('default upgraded', doc.field1)
        self.assertTrue('attachment' in doc.attachments)
示例#2
0
    def testMigrating(self):
        serialization.register(VersionedTest1)
        feat.initial_data(VersionedTest1)
        yield tools.push_initial_data(self.connection)
        doc = yield self.connection.get_document('testdoc')
        self.assertEqual('default', doc.field1)

        serialization.register(VersionedTest2)
        migration.register(SimpleMigration(type_name=VersionedTest2.type_name,
                                           source_ver=1,
                                           target_ver=2))
        yield tools.migration_script(self.connection)

        doc = yield self.connection.get_document('testdoc')
        self.assertEqual('default upgraded', doc.field1)