def test_load_user_preferences(self): """ """ load_users_and_create_baskets("test_data/user_data.txt") load_preferences("test_data/preference_data.txt") load_user_preferences("test_data/user_preference_data.txt") print "yay"
def setUp(self): """Setup to do before every test.""" # Get the Flask test client self.client = app.test_client() app.jinja_env.undefined = StrictUndefined app.jinja_env.filters['prettify_preference'] = prettify_preference # Show Flask errors that happen during tests app.config['TESTING'] = True # Connect to test database connect_to_db(app, db_uri="postgresql:///testdb") # start with empty db db.drop_all() # Create tables and add sample data db.create_all() # create db records for yarns, users, baskets, basket_yarns, # projects, and patterns create_example_data() # create db records for preferences and user_preferences load_preferences("test_data/preference_data.txt") load_user_preferences("test_data/user_preference_data.txt") load_group_events("test_data/group-events.csv")
def setUp(self): """Setup to do before every test.""" # Get the Flask test client self.client = app.test_client() # secret key to allow sessions to be used app.config['SECRET_KEY'] = 'sekrit!' # Show Flask errors that happen during tests app.config['TESTING'] = True # Connect to test database connect_to_db(app, db_uri="postgresql:///testdb") # Create tables and add sample data db.create_all() # create db records for yarns, users, baskets, basket_yarns, # projects, and patterns create_example_data() # create db records for preferences and user_preferences load_preferences("test_data/preference_data.txt") load_user_preferences("test_data/user_preference_data.txt") with self.client as c: with c.session_transaction() as session: session['username'] = '******'
def test_load_preferences(self): """ Can preferences be added to database tables? """ load_preferences("test_data/preference_data.txt") pref_list = Preference.query.all() self.assertEqual(len(pref_list), 27)