コード例 #1
0
    def test_estimation_for_the_whole_queue(self):
        QueueItemProcessedFactory(banner=self.banner,
                                  waiting_time_estimation=timedelta(minutes=5))
        QueueItemFactory(banner=self.banner)
        QueueItemFactory(banner=self.banner)
        estimation = EstimateWaitingTime(banner=self.banner).call()

        self.assertEqual(estimation, timedelta(minutes=10))
コード例 #2
0
    def test_estimation_for_the_queue_item(self):
        QueueItemProcessedFactory(banner=self.banner,
                                  waiting_time_estimation=timedelta(minutes=5))
        queue_item1 = QueueItemFactory(banner=self.banner)
        queue_item2 = QueueItemFactory(banner=self.banner)
        estimation = EstimateWaitingTime(banner=self.banner,
                                         queue_item=queue_item2).call()

        self.assertEqual(estimation, timedelta(minutes=5))
コード例 #3
0
 def time_estimation(self):
     return EstimateWaitingTime(banner=self.banner).call()
コード例 #4
0
    def test_no_processing_history(self):
        QueueItemFactory(banner=self.banner)
        estimation = EstimateWaitingTime(banner=self.banner).call()

        self.assertEqual(estimation, None)
コード例 #5
0
    def test_no_queue(self):
        QueueItemProcessedFactory(banner=self.banner)
        estimation = EstimateWaitingTime(banner=self.banner).call()

        self.assertEqual(estimation, timedelta(0))
コード例 #6
0
 def time_estimation(self):
     return EstimateWaitingTime(banner=self.banner, queue_item=self.queue_item).call()
コード例 #7
0
def queue_entrypoint(request, banner_id):
    banner = get_object_or_404(Banner, pk=banner_id)
    time_estimation = EstimateWaitingTime(banner=banner).call()
    context = {'banner': banner, 'time_estimation': time_estimation}

    return render(request, 'banners/queue_entrypoint.html', context)