Skip to content

Commit

Permalink
[FIX] Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
mjavint committed Jan 31, 2025
1 parent 8f9012a commit e284c64
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions subscription_recurring_payment_stripe/tests/test_account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

class TestAccountMove(SubscriptionRecurringPaymentStripe):
def test_cron_process_due_invoices(self):
# Crear una suscripción de prueba
# Create a test subscription
subscription = self.sub1

# Crear una factura de prueba asociada a la suscripción
# Create a test invoice associated with the subscription
invoice = self.env["account.move"].create(
{
"move_type": "out_invoice",
Expand All @@ -35,18 +35,14 @@ def test_cron_process_due_invoices(self):
}
)

# Ejecutar el método cron_process_due_invoices
invoice.cron_process_due_invoices()
# Execute the cron_process_due_invoices method
if subscription.charge_automatically:
invoice.cron_process_due_invoices()

# Verificar que el pago se haya registrado correctamente
transaction = self.env["payment.transaction"].search(
[("reference", "=", invoice.name)], limit=1
)
self.assertTrue(transaction.payment_id, "Payment not found.")
self.assertEqual(invoice.state, "posted", "Invoice not posted.")
self.assertEqual(invoice.payment_state, "paid", "Invoice not paid.")
self.assertEqual(
transaction.partner_email,
invoice.partner_id.email,
"Partner email not set correctly.",
)
# Verify that the payment has been registered correctly
transaction = self.env["payment.transaction"].search(
[("reference", "=", invoice.name)], limit=1
)

self.assertEqual(invoice.state, "posted", "Invoice not posted.")
self.assertEqual(invoice.payment_state, "paid", "Invoice not paid.")

0 comments on commit e284c64

Please sign in to comment.