

def testUpdateAverageRatingNonBatch2(self):
    'Check the number of tasks added to the queue when reviews are created.'
    models.Category.buildAllCategories()
    product = docs.Product.buildProduct(PRODUCT_PARAMS)
    config.BATCH_RATINGS_UPDATE = False
    review = models.Review(product_key=product.key, username='bob', rating=4, comment='comment')
    review.put()
    utils.updateAverageRating(review.key)
    review = models.Review(product_key=product.key, username='bob2', rating=1, comment='comment')
    review.put()
    utils.updateAverageRating(review.key)
    taskq = self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME)
    tasks = taskq.GetTasks('default')
    taskq.FlushQueue('default')
    self.assertEqual(len(product), 2)

dataset/ETHPy150Open GoogleCloudPlatform/appengine-search-python-java/product_search_python/tests/test_search.py FTSTestCase.testUpdateAverageRatingNonBatch2/VarMisuse@152/232 `tasks`->`product`