def test_date_due_gets_set_autopay(self):
        Subscription.objects.all().delete()
        plan = DefaultProductPlan.objects.get(
            edition=SoftwarePlanEdition.STANDARD,
            product_type=SoftwareProductType.COMMCARE,
            is_trial=False
        ).plan.get_version()

        subscription_length = 4
        subscription_start_date = datetime.date(2016, 2, 23)
        subscription_end_date = add_months_to_date(subscription_start_date, subscription_length)
        autopay_subscription = generator.generate_domain_subscription(
            self.account,
            self.domain,
            date_start=subscription_start_date,
            date_end=subscription_end_date,
            plan_version=plan
        )

        autopay_subscription.account.update_autopay_user(self.billing_contact.username, self.domain)
        invoice_date_autopay = utils.months_from_date(autopay_subscription.date_start, 1)
        tasks.generate_invoices(invoice_date_autopay)

        autopay_invoice = autopay_subscription.invoice_set.last()
        self.assertTrue(autopay_invoice.balance <= SMALL_INVOICE_THRESHOLD)
        self.assertIsNotNone(autopay_invoice.date_due)
Initializer.
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/accounting/tests/test_invoicing.py/TestInvoice.test_date_due_gets_set_autopay--crossover with--dataset/ETHPy150Open dansanderson/picotool/pico8/game/game.py/Game.__init__