Beispiel #1
0
    def test_check_frozen_expired_invoices__wrong_state(self):
        for state in INVOICE_STATE.records:
            if state.is_FROZEN:
                continue

            self.create_invoice(state=state)
            self.assertFalse(InvoicePrototype.check_frozen_expired_invoices())
            InvoicePrototype._db_all().delete()
Beispiel #2
0
    def test_check_frozen_expired_invoices__wrong_state(self):
        for state in INVOICE_STATE.records:
            if state.is_FROZEN:
                continue

            self.create_invoice(state=state)
            self.assertFalse(InvoicePrototype.check_frozen_expired_invoices())
            InvoicePrototype._db_all().delete()
Beispiel #3
0
    def check_frozen_expired_invoices(self):

        if time.time() - float(settings.get(bank_settings.SETTINGS_LAST_FROZEN_EXPIRED_CHECK_KEY, 0)) < bank_settings.FROZEN_INVOICE_EXPIRED_CHECK_TIMEOUT:
            return

        settings[bank_settings.SETTINGS_LAST_FROZEN_EXPIRED_CHECK_KEY] = str(time.time())

        if not InvoicePrototype.check_frozen_expired_invoices():
            return

        self.logger.error('We have some expired frozen invoices. Please, check them and remove or find error.')
Beispiel #4
0
    def check_frozen_expired_invoices(self):

        if time.time() - float(settings.get(bank_settings.SETTINGS_LAST_FROZEN_EXPIRED_CHECK_KEY, 0)) < bank_settings.FROZEN_INVOICE_EXPIRED_CHECK_TIMEOUT:
            return

        settings[bank_settings.SETTINGS_LAST_FROZEN_EXPIRED_CHECK_KEY] = str(time.time())

        if not InvoicePrototype.check_frozen_expired_invoices():
            return

        self.logger.error('We have some expired frozen invoices. Please, check them and remove or find error.')
Beispiel #5
0
 def test_check_frozen_expired_invoices__exist(self):
     invoice = self.create_invoice(state=INVOICE_STATE.FROZEN)
     InvoicePrototype._db_filter(id=invoice.id).update(
         updated_at=datetime.datetime.now() - bank_settings.FROZEN_INVOICE_EXPIRED_TIME
     )
     self.assertTrue(InvoicePrototype.check_frozen_expired_invoices())
Beispiel #6
0
 def test_check_frozen_expired_invoices__wrong_time(self):
     self.create_invoice(state=INVOICE_STATE.FROZEN)
     self.assertFalse(InvoicePrototype.check_frozen_expired_invoices())
Beispiel #7
0
 def test_check_frozen_expired_invoices__exist(self):
     invoice = self.create_invoice(state=INVOICE_STATE.FROZEN)
     InvoicePrototype._db_filter(
         id=invoice.id).update(updated_at=datetime.datetime.now() -
                               bank_settings.FROZEN_INVOICE_EXPIRED_TIME)
     self.assertTrue(InvoicePrototype.check_frozen_expired_invoices())
Beispiel #8
0
 def test_check_frozen_expired_invoices__wrong_time(self):
     self.create_invoice(state=INVOICE_STATE.FROZEN)
     self.assertFalse(InvoicePrototype.check_frozen_expired_invoices())