def calculate_rating_for_all_celery(): """ This method is called inside a periodic task initialized below. The work of this task if get all restaurants inside the database and calculate the rating for each restaurants. """ RestaurantService.calculate_rating_for_all_restaurant()
def test_get_all_restaurant_rating_not_fail(self): """ test about the services restaurant to test the result of calculate rating for all restaurants :return: """ new_restaurant = Utils.create_restaurant() new_review1 = Utils.create_review(new_restaurant.id, 3) new_review2 = Utils.create_review(new_restaurant.id, 5) new_review3 = Utils.create_review(new_restaurant.id, 2.5) response = RestaurantService.calculate_rating_for_all_restaurant() assert response is True Utils.delete_review(new_review1.id) Utils.delete_review(new_review2.id) Utils.delete_review(new_review3.id) Utils.delete_restaurant(new_restaurant.id)