def METHOD_NAME(self, invoice, url_generated=False):
    self.assertIsNotNone(invoice)
    self.assertIsNotNone(invoice.id)
    self.assertIsNotNone(invoice.name)
    self.assertIsNotNone(invoice.type)
    self.assertTrue(len(invoice.billing_period_ids) > 0)
    self.assertTrue(invoice.invoice_period_start_date <= invoice.invoice_period_end_date)
    if url_generated:
        self.assertIsNotNone(invoice.download_url.url)
        self.assertIsNotNone(invoice.download_url.expiry_time)
    else:
        self.assertIsNone(invoice.download_url)