def setUp(cls): """Do once before all tests in this class""" # Get the Flask test client cls.client = app.test_client() # Show Flask errors that happen during tests app.config['TESTING'] = True # Connect to test database connect_to_db(app, "postgresql:///testdb") # Create tables from model db.create_all() # Import different types of data from seed file seed.load_users() seed.load_groups() seed.load_usergroups() seed.load_patterns() seed.load_invites() seed.set_val_user_id() seed.set_val_group_id() seed.set_val_usergroup_id() seed.set_val_pattern_id() seed.set_val_invite_id() with cls.client as c: with c.session_transaction() as sess: sess['user_id'] = 1 c.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')
def setUp(self): """Do at the beginning of every test""" # Get the Flask test client self.client = app.test_client() # Show Flask errors that happen during tests app.config['TESTING'] = True # Connect to test database connect_to_db(app, "postgresql:///testdb") # Create tables from model db.create_all() # Import different types of data from seed file seed.load_users() seed.load_groups() seed.load_usergroups() seed.load_patterns() seed.load_invites() # Reset auto incrementing primary keys to start after seed data seed.set_val_user_id() seed.set_val_group_id() seed.set_val_usergroup_id() seed.set_val_pattern_id() seed.set_val_invite_id() with self.client as c: with c.session_transaction() as sess: sess['user_id'] = 1 c.set_cookie('localhost', 'MYCOOKIE', 'cookie_value')
def setUp(self): # Get the Flask test client self.client = app.test_client() # Show Flask errors that happen during tests app.config['TESTING'] = True # Connect to test database connect_to_db(app, "postgresql:///testdb") # Create tables from model db.create_all() # Import different types of data from seed file seed.load_users() seed.load_groups() seed.load_usergroups() seed.load_patterns() seed.load_invites() # Reset auto incrementing primary keys to start after seed data seed.set_val_user_id() seed.set_val_group_id() seed.set_val_usergroup_id() seed.set_val_pattern_id() seed.set_val_invite_id()