예제 #1
0
    def test_delete_a_recommendation(self):
        """ Delete a Recommendation """
        recommendation = Recommendation(product_id=PS4,
                                        recommended_product_id=CONTROLLER,
                                        recommendation_type="accessory")
        recommendation.save()
        self.assertEqual(len(Recommendation.all()), 1)

        # delete the recommendation and make sure it isn't in the database
        recommendation.delete()
        self.assertEqual(len(Recommendation.all()), 0)
예제 #2
0
    def test_delete_a_recommendation(self):
        """ Delete a Recommendation """
        data = {
            "product_id": 54,
            "rec_type_id": 1,
            "rec_product_id": 45,
            "weight": .5
        }
        rec = Recommendation()
        rec.deserialize(data)
        rec.save()

        self.assertEqual(Recommendation.count(), 1)

        # delete the recommendation and make sure it isn't in the database
        rec.delete()
        self.assertEqual(Recommendation.count(), 0)