Ejemplo n.º 1
0
    def run_random_premium_requests_processing(self):
        while True:
            request = RandomPremiumRequestPrototype.get_unprocessed()

            if request is None:
                return

            self.logger.info('process random premium request %d' % request.id)

            if not request.process():
                self.logger.info('request %d not processed' % request.id)
                return
            else:
                self.logger.info('request %d processed' % request.id)
Ejemplo n.º 2
0
    def run_random_premium_requests_processing(self):
        while True:
            request = RandomPremiumRequestPrototype.get_unprocessed()

            if request is None:
                return

            self.logger.info('process random premium request %d' % request.id)

            if not request.process():
                self.logger.info('request %d not processed' % request.id)
                return
            else:
                self.logger.info('request %d processed' % request.id)
 def test_get_unprocessed__has_waiting(self):
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed().id, self.request.id)
 def test_get_unprocessed__no_waiting(self):
     RandomPremiumRequestPrototype._db_all().update(state=relations.RANDOM_PREMIUM_REQUEST_STATE.PROCESSED)
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed(), None)
 def test_get_unprocessed__not_exist(self):
     RandomPremiumRequestPrototype._db_all().delete()
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed(), None)
 def test_get_unprocessed__has_waiting(self):
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed().id,
                      self.request.id)
 def test_get_unprocessed__no_waiting(self):
     RandomPremiumRequestPrototype._db_all().update(
         state=relations.RANDOM_PREMIUM_REQUEST_STATE.PROCESSED)
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed(), None)
 def test_get_unprocessed__not_exist(self):
     RandomPremiumRequestPrototype._db_all().delete()
     self.assertEqual(RandomPremiumRequestPrototype.get_unprocessed(), None)