def setUp(self): app.config['SQLALCHEMY_DATABASE_URI'] = TEST_DSN db.engine.execute(DROP_TEST_DB) db.engine.execute(CREATE_TEST_DB) db.engine.execute(USE_TEST_DB) db.create_all() app.config['TESTING'] = True self.app = app.test_client()
import sys, os from srvadm import db from srvadm import app if __name__ == '__main__': if len(sys.argv) == 2: if sys.argv[1] == 'init': db.create_all() elif sys.argv[1] == 'run': app.run(host='0.0.0.0', port=5000)
def setUp(self): app.config['SQLALCHEMY_DATABASE_URI'] = TEST_DSN db.engine.execute(DROP_TEST_DB) db.engine.execute(CREATE_TEST_DB) db.engine.execute(USE_TEST_DB) db.create_all()