def setUp(self): # set up fake test browser self.client = app.test_client() # connect to temporary database connect_to_db(app, "sqlite:///") # This line makes a 500 error in a route raise an error in a test app.config['TESTING'] = True # create tables and add sample data db.create_all() example_data_rec_areas() example_data_users() example_data_visits()
def setUp(self): # set up fake test browser self.client = app.test_client() # connect to temporary database connect_to_db(app, "sqlite:///") # This line makes a 500 error in a route raise an error in a test app.config['TESTING'] = True # create tables and add sample data db.create_all() example_data_rec_areas() example_data_users() example_data_visits() # initiate a session with self.client as c: with c.session_transaction() as sess: sess['user'] = '******' c.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')