예제 #1
0
 def test_remove_all(self):
     """ Remove all entries """
     Promotion(name="20%OFF", product_id=9527, discount_ratio=80).save()
     Promotion(name="50%OFF", product_id=26668).save()
     Promotion.remove_all()
     promotions = Promotion.all()
     self.assertEqual(len(promotions), 0)
예제 #2
0
 def test_delete_all_promotions(self):
     """ Delete all promotions in the database """
     promotion1 = Promotion(promo_name="random1",
                            goods_name="random_good1",
                            category="random_category1",
                            price=20,
                            discount=20,
                            available=True)
     promotion1.save()
     promotion2 = Promotion(promo_name="random2",
                            goods_name="random_good2",
                            category="random_category2",
                            price=20,
                            discount=20,
                            available=True)
     promotion2.save()
     self.assertEqual(len(Promotion.all()), 2)
     Promotion.remove_all()
     self.assertEqual(len(Promotion.all()), 0)
def data_reset():
    Promotion.remove_all()
 def setUp(self):
     Promotion.init_db()
     Promotion.remove_all()
예제 #5
0
 def setUp(self):
     """ Initialize the Cloudant database """
     Promotion.init_db("test_promotion")
     Promotion.remove_all()
예제 #6
0
def reset():
    """
    Reset the Database for test purposes
    """
    Promotion.remove_all()
    return make_response('', status.HTTP_204_NO_CONTENT)
예제 #7
0
def data_reset():
    """ Removes all Promotions from the database """
    Promotion.remove_all()
예제 #8
0
def promotions_reset():
    """ Removes all promotions from the database """
    Promotion.remove_all()
    return make_response('', status.HTTP_204_NO_CONTENT)