Esempio n. 1
0
    def test_by_sql_file(self):
        """test by sql file"""
        udb = UnittestDB()
        metadata = udb.load_from_file('starting_db.yaml')
        connection = self.engine.connect()
        metadata.bind = connection
        metadata.drop_all()
        connection.close()

        udb = UnittestDB()
        metadata = udb.read_from_oracle('oracle.sql')
#        for table in metadata.sorted_tables:
#            print table.name
#            for col in table.columns:
#                print col
        metadata.bind = self.engine
        metadata.create_all()
        udb.fill_tables(metadata, 10)
        metadata.drop_all()
Esempio n. 2
0
    def test_fill(self):
        """test fill"""
#        if path.exists('unittest2.db'):
#            unlink('unittest2.db')
        udb = UnittestDB()
        metadata = udb.load_from_file('starting_db.yaml')
#        for table in metadata.sorted_tables:
#            print table.name
#            for col in table.columns:
#                print col

        connection = self.engine.connect()
        metadata.bind = connection
        metadata.drop_all()
        for table in metadata.sorted_tables:
            for col in table.columns:
                col.autoincrement = False
        metadata.create_all()
        udb.fill_tables(metadata, 10)
        connection.close()