def test_update_with_a_zero_rating(self): """ Ensure that if a rating is updated with zero, the overall rating returned is equal to zero """ overall = Rating.update(self.expedition, self.paltman, rating=0, category=self.speed) self.assertEquals(overall, Decimal("0"))
def create_rating(self, user, rating, obj=None, category=""): """ Helper function to post a rating for the benz object of type Car used in the tests :param user: User :param rating: int :param obj: obj :param category: str :return: http response object """ if not obj: obj = self.expedition cat_choice = category_value(obj, category) if not cat_choice: cat_choice = "" Rating.update(rating_object=obj, user=user, category=cat_choice, rating=rating)
def create_rating(self, user, rating, obj=None, category=""): """ Helper function to post a rating for the benz object of type Car used in the tests :param user: User :param rating: int :param obj: obj :param category: str :return: http response object """ if not obj: obj = self.expedition cat_choice = category_value(obj, category) if not cat_choice: cat_choice = "" Rating.update( rating_object=obj, user=user, category=cat_choice, rating=rating )
def test_rating(self): overall = Rating.update(self.bronco, self.paltman, rating=5) self.assertEquals(overall, Decimal("5")) overall = Rating.update(self.bronco, self.jtauber, rating=2) self.assertEquals(overall, Decimal("3.5"))