Esempio n. 1
0
def create_new_db():
    # Drop old database, then make a new one.
    print('Clearing current database...')
    database.reflect()
    database.drop_all()
    print('Creating new database...')
    database.create_all()
    database.session.commit()
    print("Database created.")

    print("Loading data from JSON...")
Esempio n. 2
0
def app(request):
    app = create_app(TestConfig)
    app.app_context().push()

    # def teardown():
    #     app.app_context().pop()

    # request.addfinalizer(teardown)
    # return app
    with app.app_context():
        # alternative pattern to app.app_context().push()
        # all commands indented under 'with' are run in the app context
        database.create_all()
        yield app  # Note that we changed return for yield, see below for why
        database.session.remove(
        )  # looks like db.session.close() would work as well
        database.drop_all()
 def tearDown(self):
     database.session.remove()
     database.drop_all()
     self.app_context.pop()
Esempio n. 4
0
	def tearDown(self):
		database.drop_all()
		self.logout()
Esempio n. 5
0
 def tearDown(self):
     database.drop_all()
     self.logout()
Esempio n. 6
0
def reset():
    database.drop_all()
    database.create_all()
    importData()
Esempio n. 7
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Esempio n. 8
0
 def tearDown(self):
     database.session.remove()
     database.drop_all()
Esempio n. 9
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
     for table in db.engine.table_names():
         db.engine.execute('DROP TABLE "{0}"'.format(table))
Esempio n. 10
0
 def setUp(self):
     database.session.close()
     database.drop_all()
     database.create_all()
Esempio n. 11
0
 def tearDown(self):
     database.session.close()
     database.drop_all()