def setUp(self): self.app = create_app({ 'TESTING': True, 'DATA_FILE': 'covid_data_test.csv' }) self.df = pd.DataFrame(utd.d) self.df['dateRep'] = self.df['dateRep'].map( lambda x: datetime.strptime(x, '%d/%m/%Y').date( )) # from str to date
def client(): my_app = create_app({ 'TESTING': True, # Set to True during testing. 'TEST_DATA_PATH': TEST_DATA_PATH, # Path for loading test data into the repository. 'WTF_CSRF_ENABLED': False # test_client will not send a CSRF token, so disable validation. }) return my_app.test_client()
def client(): my_app = create_app({ 'TESTING': True, # Set to True during testing. 'REPOSITORY': 'memory', # Set to 'memory' or 'database' depending on desired repository. 'TEST_DATA_PATH': TEST_DATA_PATH_MEMORY, # Path for loading test data into the repository. 'WTF_CSRF_ENABLED': False # test_client will not send a CSRF token, so disable validation. }) return my_app.test_client()
def setUp(self): #< without <'WTF_CSRF_ENABLED': False>, we are going to receive a csrf token error # when testing for forms, i.e. /select and /other_select URLs using POST self.app = create_app({ 'TESTING': True, 'DATA_FILE': 'covid_data_test.csv', 'WTF_CSRF_ENABLED': False, }) self.df = pd.DataFrame(utd.d) self.df['dateRep'] = self.df['dateRep'].map( lambda x: datetime.strptime(x, '%d/%m/%Y').date( )) # from str to date
def client(): my_app = create_app({ 'TESTING': True, # Set to True during testing. 'REPOSITORY': 'database', # Set to 'memory' or 'database' depending on desired repository. 'SQLALCHEMY_DATABASE_URI': TEST_DATABASE_URI, # Use an in-memory SQLite database for testing 'database' repo. 'TEST_DATA_PATH': TEST_DATA_PATH, # Path for loading test data into the repository. 'WTF_CSRF_ENABLED': False # test_client will not send a CSRF token, so disable validation. }) return my_app.test_client()
"""App entry point.""" from covid import create_app app = create_app() if __name__ == "__main__": app.run(host='localhost', port=5000, threaded=False)
def setUp(self): self.app = create_app({ 'TESTING': True, 'DATA_FILE': 'covid_data_test.csv' })
def setUp(self): self.app = create_app({ 'TESTING': True, })