def setUp(self): """Runs before each test""" self.app = app.test_client() Recommendation.init_db("tests") sleep(0.5) Recommendation.remove_all() sleep(0.5) Recommendation(id=1, productId='Infinity Gauntlet', suggestionId='Soul Stone', categoryId='Comics').save() sleep(0.5) Recommendation(id=2, productId='iPhone', suggestionId='iphone Case', categoryId='Electronics').save() sleep(0.5)
def setUp(self): sleep(0.5) Recommendation.init_db() sleep(0.5) Recommendation.remove_all() sleep(0.5)
def test_init_db(self): Recommendation.init_db("recommendations") self.assertIsNotNone(Recommendation.client)
def setUpClass(cls): """ These run once per Test suite """ app.debug = False # Set up the test database app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI Recommendation.init_db(app)
def init_db(): """ Initialies the SQLAlchemy app """ global app Recommendation.init_db(app)