def test_create_shadow_table_by_table_instance(self): table_name = 'test_create_shadow_table_by_table_instance' table = Table(table_name, self.meta, Column('id', Integer, primary_key=True), Column('a', Integer), Column('b', String(256))) table.create() utils.create_shadow_table(self.engine, table=table) self.assertTrue(utils.check_shadow_table(self.engine, table_name))
def test_create_duplicate_shadow_table(self): table_name = 'test_create_duplicate_shadow_table' table = Table(table_name, self.meta, Column('id', Integer, primary_key=True), Column('a', Integer)) table.create() utils.create_shadow_table(self.engine, table_name=table_name) self.assertRaises(exception.ShadowTableExists, utils.create_shadow_table, self.engine, table_name=table_name)
def test_create_shadow_table_not_supported_type(self): table_name = 'test_create_shadow_table_not_supported_type' table = Table(table_name, self.meta, Column('id', Integer, primary_key=True), Column('a', CustomType)) table.create() # reflection of custom types has been fixed upstream if SA_VERSION < (0, 9, 0): self.assertRaises(oslodbutils.ColumnError, utils.create_shadow_table, self.engine, table_name=table_name) utils.create_shadow_table(self.engine, table_name=table_name, a=Column('a', CustomType())) self.assertTrue(utils.check_shadow_table(self.engine, table_name))