def create_app(self): """ Instructs Flask to run these commands when we request this group of tests to be run. """ # Sets the configuration of the application to 'TestingConfig' in order # that the tests use db_test, not db_dev or db_prod. app.config.from_object('config.TestingConfig') # Sets the logger to only show ERROR level logs and worse. We don't want # to print a million things when running tests. LOGGER.setLevel(logging.ERROR) return app
def setUp(self): app.config['TESTING'] = True app.config['DEBUG'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' self.app = app.test_client() db.reflect() db.drop_all() db.create_all() LOGGER.setLevel('ERROR') # Add dummy metadata self.user_category = UserCategory('Postdoc') db.session.add(self.user_category) self.country = Country('South Africa') db.session.add(self.country) # Add a dummy organisation self.add_organisation(domain='org') db.session.flush()