def client(): """ A Werkzeug client in testing mode with a newly created database. """ app.config['TESTING'] = True with app.app_context(): db.drop_all() db.create_all() yield app.test_client() db.drop_all()
def database(): """ Deliver up the database associated with the application. """ app.config['TESTING'] = True with app.app_context(): db.drop_all() db.create_all() yield db db.drop_all()
def database(): """Deliver up the database associated with the application. Whatever the location of the database for the current configuration, override it for the tests. """ app.config['TESTING'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' with app.app_context(): db.drop_all() db.create_all() yield db db.session.rollback() db.drop_all()
def client(): """A Werkzeug client in testing mode with a newly created database. Whatever the location of the database for the current configuration, override it for the tests. """ app.config['TESTING'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' with app.app_context(): db.drop_all() db.create_all() yield app.test_client() db.session.rollback() db.drop_all()
def client(): """A Werkzeug client in testing mode with a newly created database. Whatever the location of the database for the current configuration, override it for the tests. """ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['DEBUG'] = False app.config['TESTING'] = True app.config['SECRET_KEY'] = "TheObviouslyOpenSecret" app.config['MAINTENANCE'] = False app.config['CALL_OPEN'] = False app.config['REVIEWING_ALLOWED'] = False app.config['ADMINISTERING'] = False app.config['API_ACCESS'] = False with app.app_context(): db.drop_all() db.create_all() yield app.test_client() db.session.rollback() db.drop_all()
def teardown_method(self, testmethod): db.drop_all()