diff --git a/make_post_sell/tests/test_invoice_deletion.py b/make_post_sell/tests/test_invoice_deletion.py index d18ef11..6d90f84 100644 --- a/make_post_sell/tests/test_invoice_deletion.py +++ b/make_post_sell/tests/test_invoice_deletion.py @@ -54,6 +54,7 @@ class TestInvoiceDeletion(unittest.TestCase): "message": "Deleted successfully", } self.mock_crypto_payment.status = CryptoPayment.STATUS_CANCELLED + self.mock_crypto_payment.should_keep_invoice.return_value = False delete_invoice_for_terminal_state(self.mock_dbsession, self.mock_crypto_payment) @@ -72,6 +73,7 @@ class TestInvoiceDeletion(unittest.TestCase): "message": "Deleted successfully", } self.mock_crypto_payment.status = CryptoPayment.STATUS_LATEPAY_NOT_REFUNDED + self.mock_crypto_payment.should_keep_invoice.return_value = False delete_invoice_for_terminal_state(self.mock_dbsession, self.mock_crypto_payment) @@ -101,6 +103,7 @@ class TestInvoiceDeletion(unittest.TestCase): self.mock_crypto_payment.invoice = self.mock_invoice self.mock_crypto_payment.invoice_id = "test-invoice-123" self.mock_crypto_payment.status = status + self.mock_crypto_payment.should_keep_invoice.return_value = False delete_invoice_for_terminal_state( self.mock_dbsession, self.mock_crypto_payment @@ -164,6 +167,7 @@ class TestInvoiceDeletion(unittest.TestCase): """Test that invoice deletion failures are handled gracefully.""" mock_delete_invoice.side_effect = Exception("Database error") self.mock_crypto_payment.status = CryptoPayment.STATUS_EXPIRED + self.mock_crypto_payment.should_keep_invoice.return_value = False # Should not raise exception delete_invoice_for_terminal_state(self.mock_dbsession, self.mock_crypto_payment) @@ -186,6 +190,7 @@ class TestInvoiceDeletion(unittest.TestCase): "message": "Deletion failed", } self.mock_crypto_payment.status = CryptoPayment.STATUS_EXPIRED + self.mock_crypto_payment.should_keep_invoice.return_value = False delete_invoice_for_terminal_state(self.mock_dbsession, self.mock_crypto_payment)