Beispiel #1
0
 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"))
Beispiel #2
0
 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"))
Beispiel #3
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)
Beispiel #4
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
     )
Beispiel #5
0
 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"))
Beispiel #6
0
 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"))