def fresh_create(make_objects): """Create a fresh database, and populate it with an initial set of objects. The objects are created via `make_objects`. These objects should be such that a migrated database dump will have the same contents. """ create_db() make_objects()
def test_populate_dirty_db(): """running the allocator's populate() on an existing db should be ok. This includes the case where modifications have been made to the vlans in the database. Note that we only check that this doesn't raise an exception. """ # The fresh_database fixture will have created a clean database for us. We # just tweak it and then re-run create_db with app.app_context(): # flag vlan 100 as in-use, just so the db isn't quite pristine. vlan100 = Vlan.query.filter_by(vlan_no=100) vlan100.available = False db.session.commit() # Okay, now try re-initializing: create_db()
def newDB(): """Configures and returns a connection to a freshly initialized DB.""" with app.app_context(): init_db() create_db()
def create(): """Initialize the database.""" server.init() create_db()