# Path: mollie/api/objects/invoice.py
# class Invoice(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.invoices import Invoices
# 
#         return Invoices(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def reference(self):
#         return self._get_property("reference")
# 
#     @property
#     def vat_number(self):
#         return self._get_property("vatNumber")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def issued_at(self):
#         return self._get_property("issuedAt")
# 
#     @property
#     def paid_at(self):
#         return self._get_property("paidAt")
# 
#     @property
#     def due_at(self):
#         return self._get_property("dueAt")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def net_amount(self):
#         return self._get_property("netAmount")
# 
#     @property
#     def vat_amount(self):
#         return self._get_property("vatAmount")
# 
#     @property
#     def gross_amount(self):
#         return self._get_property("grossAmount")
# 
#     @property
#     def lines(self):
#         return self._get_property("lines") or []
# 
#     @property
#     def pdf(self):
#         return self._get_link("pdf")
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


from mollie.api.objects.invoice import Invoice
from .utils import assert_list_object


INVOICE_ID = "inv_xBEbP9rvAq"


def test_list_invoices(oauth_client, response):
    """Retrieve a list of existing invoices."""
    response.get("https://api.mollie.com/v2/invoices", "invoices_list")

    invoices = oauth_client.invoices.list()
    assert_list_object(invoices, Invoice)


def test_get_invoice(oauth_client, response):
    """Retrieve a single invoice."""
    response.get(f"https://api.mollie.com/v2/invoices/{INVOICE_ID}", "invoice_single")

    invoice = oauth_client.invoices.get(INVOICE_ID)

# Path: mollie/api/objects/invoice.py
# class Invoice(ObjectBase):
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.invoices import Invoices
# 
#         return Invoices(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def reference(self):
#         return self._get_property("reference")
# 
#     @property
#     def vat_number(self):
#         return self._get_property("vatNumber")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def issued_at(self):
#         return self._get_property("issuedAt")
# 
#     @property
#     def paid_at(self):
#         return self._get_property("paidAt")
# 
#     @property
#     def due_at(self):
#         return self._get_property("dueAt")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def net_amount(self):
#         return self._get_property("netAmount")
# 
#     @property
#     def vat_amount(self):
#         return self._get_property("vatAmount")
# 
#     @property
#     def gross_amount(self):
#         return self._get_property("grossAmount")
# 
#     @property
#     def lines(self):
#         return self._get_property("lines") or []
# 
#     @property
#     def pdf(self):
#         return self._get_link("pdf")
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


# Path: tests/test_invoices.py
from mollie.api.objects.invoice import Invoice
from .utils import assert_list_object



INVOICE_ID = "inv_xBEbP9rvAq"


def test_list_invoices(oauth_client, response):
    """Retrieve a list of existing invoices."""
    response.get("https://api.mollie.com/v2/invoices", "invoices_list")

    invoices = oauth_client.invoices.list()
    assert_list_object(invoices, Invoice)


def test_get_invoice(oauth_client, response):
    """Retrieve a single invoice."""
    response.get(f"https://api.mollie.com/v2/invoices/{INVOICE_ID}", "invoice_single")

    invoice = oauth_client.invoices.get(INVOICE_ID)

    assert isinstance(invoice, Invoice)