Ejemplo n.º 1
0
    def test_wiki_data_migrated(self):
        """Wiki data is migrated on table upgrade."""
        now = to_utimestamp(datetime_now(utc))
        wiki_column_names = \
            [col.name for col in old_wiki_schema.columns]
        wiki_data = (
            ('TracGuide', 2, now, 'user2', '::4', 'The guide', 'Edit', 0),
            ('WikiStart', 1, now, 'user1', '::3', 'The page', 'Init', 1))
        self.dbm.insert_into_tables((('wiki', wiki_column_names, wiki_data),))

        db42.do_upgrade(self.env, VERSION, None)

        ipnr_col = wiki_column_names.index('ipnr')
        i = 0
        for i, data in enumerate(self.env.db_query("""
                SELECT * FROM wiki ORDER BY name
                """)):
            self.assertEqual(wiki_data[i][:ipnr_col] +
                             wiki_data[i][ipnr_col+1:], data)
        self.assertEqual(len(wiki_data), i+1)
Ejemplo n.º 2
0
    def test_attachments_data_migrated(self):
        """Attachment data is migrated on table upgrade."""
        now = to_utimestamp(datetime_now(utc))
        attachment_column_names = \
            [col.name for col in old_attachment_schema.columns]
        attachment_data = (
            ('ticket', '1', 'file1', 10, now, 'desc1', 'user1', '::1'),
            ('wiki', 'WikiStart', 'file2', 20, now, 'desc2', 'user2', '::2'))
        self.dbm.insert_into_tables((('attachment', attachment_column_names,
                                      attachment_data),))

        db42.do_upgrade(self.env, VERSION, None)

        ipnr_col = attachment_column_names.index('ipnr')
        i = 0
        for i, data in enumerate(self.env.db_query("""
                SELECT * FROM attachment ORDER BY type
                """)):
            self.assertEqual(attachment_data[i][:ipnr_col] +
                             attachment_data[i][ipnr_col+1:], data)
        self.assertEqual(len(attachment_data), i+1)
Ejemplo n.º 3
0
    def test_wiki_table_upgraded(self):
        """The ipnr column is removed from the wiki table."""
        db42.do_upgrade(self.env, VERSION, None)

        column_names = [col.name for col in new_wiki_schema.columns]
        self.assertEqual(column_names, self.dbm.get_column_names('wiki'))