def setUp(self): dbwrap.connect(connect='sqlite:///:memory:') dbwrap.Base.metadata.create_all() db = dbwrap.session() model.create_sample_data() self.db = db
def setUp(self): dbwrap.connect(connect='sqlite:///:memory:') dbwrap.Base.metadata.create_all() db = dbwrap.session() model.create_sample_data() self.db = db from webtest import TestApp from bottle import TEMPLATE_PATH TEMPLATE_PATH.insert(0, '../views') self.app = website.build_application() self.harness = TestApp(self.app)
import model import bottle if os.environ.get('GATEWAY_INTERFACE'): # Called from CGI app = website.build_application() bottle.run(app, server=bottle.CGIServer) sys.exit(0) if 'test-server' in sys.argv[1:]: 'Run stand-alone test server' sys.path.append('tests') if os.environ.get('DBCREDENTIALSTR') == 'sqlite:///:memory:': model.initdb() model.create_sample_data() app = website.build_application() bottle.debug(True) bottle.run(app, reloader=True, host='127.0.0.1', port=8080) sys.exit(0) if 'initdb' in sys.argv[1:]: 'Run database initialization' model.initdb() sys.exit(0) if 'load-test-data' in sys.argv[1:]: 'Load test data-set' model.create_sample_data() sys.exit(0)