예제 #1
0
 def test_reset(self):
     """ Reset """
     recommendation = Recommendation(customer_id=2,
                                     product_id=3, recommend_product_id=4,
                                     recommend_type="upsell")
     recommendation.save()
     self.assertEqual(len(Recommendation.all()), 1)
     # delete the recommendation and make sure it isn't in the database
     recommendation.remove_all()
     self.assertEqual(len(Recommendation.all()), 0)
예제 #2
0
 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)
예제 #3
0
 def setUp(self):
     sleep(0.5)
     Recommendation.init_db()
     sleep(0.5)
     Recommendation.remove_all()
     sleep(0.5)
예제 #4
0
 def tearDown(self):
     """Runs towards the end of each test"""
     Recommendation.remove_all()
def recommendations_reset():
    """ Removes all recommendations from the database """
    Recommendation.remove_all()
    return make_response('', status.HTTP_204_NO_CONTENT)
예제 #6
0
 def delete(self):
     """ Removes all recommendations from the database """
     # app.logger.info(os.environ)
     Recommendation.remove_all()
     return '', status.HTTP_204_NO_CONTENT