예제 #1
0
 def test_add_docs_amount_to_tender(self):
     self.assertEqual(self.process_tracker.tender_documents_to_process, {})
     self.process_tracker.add_docs_amount_to_tender(self.tender_id, 2)
     self.assertEqual(self.process_tracker.tender_documents_to_process,
                      {db_key(self.tender_id): 2})
     self.process_tracker.add_docs_amount_to_tender(self.tender_id, 3)
     self.assertEqual(self.process_tracker.tender_documents_to_process,
                      {db_key(self.tender_id): 5})
예제 #2
0
 def test_remove_docs_amount_from_tender(self):
     self.assertEqual(self.process_tracker.tender_documents_to_process, {})
     self.process_tracker.tender_documents_to_process = {
         db_key(self.tender_id): 2
     }
     self.assertEqual(self.process_tracker.tender_documents_to_process,
                      {db_key(self.tender_id): 2})
     self.process_tracker.remove_docs_amount_from_tender(self.tender_id)
     self.assertEqual(self.process_tracker.tender_documents_to_process,
                      {db_key(self.tender_id): 1})
     self.process_tracker.remove_docs_amount_from_tender(self.tender_id)
     self.assertEqual(self.process_tracker.tender_documents_to_process, {})
예제 #3
0
 def _remove_docs_amount_from_tender(self, tender_id):
     if self.tender_documents_to_process[tender_id] > 1:
         self.tender_documents_to_process[tender_id] -= 1
     else:
         self._db.put(db_key(tender_id),
                      datetime.now().isoformat(), self.ttl)
         del self.tender_documents_to_process[tender_id]
예제 #4
0
 def test_set_item(self):
     self.assertEqual(self.process_tracker.processing_items, {})
     self.assertEqual(self.process_tracker.tender_documents_to_process, {})
     self.process_tracker.set_item(self.tender_id, self.item_id, 1)
     self.assertEqual(self.process_tracker.processing_items,
                      {item_key(self.tender_id, self.item_id): 1})
     self.assertEqual(self.process_tracker.tender_documents_to_process,
                      {db_key(self.tender_id): 1})
예제 #5
0
 def check_processed_tenders(self, tender_id):
     return self._db.has(db_key(tender_id)) or False