|
1 | 1 | import pytest |
2 | 2 |
|
| 3 | +from mpt_api_client.resources.billing.invoice_attachments import ( |
| 4 | + AsyncInvoiceAttachmentsService, |
| 5 | + InvoiceAttachmentsService, |
| 6 | +) |
3 | 7 | from mpt_api_client.resources.billing.invoices import ( |
4 | 8 | AsyncInvoicesService, |
5 | 9 | InvoicesService, |
@@ -30,3 +34,29 @@ def test_mixins_present(invoices_service, method): |
30 | 34 | ) |
31 | 35 | def test_async_mixins_present(async_invoices_service, method): |
32 | 36 | assert hasattr(async_invoices_service, method) |
| 37 | + |
| 38 | + |
| 39 | +@pytest.mark.parametrize( |
| 40 | + ("service_method", "expected_service_class"), |
| 41 | + [ |
| 42 | + ("attachments", InvoiceAttachmentsService), |
| 43 | + ], |
| 44 | +) |
| 45 | +def test_property_services(invoices_service, service_method, expected_service_class): |
| 46 | + service = getattr(invoices_service, service_method)("INV-0000-0001") |
| 47 | + |
| 48 | + assert isinstance(service, expected_service_class) |
| 49 | + assert service.endpoint_params == {"invoice_id": "INV-0000-0001"} |
| 50 | + |
| 51 | + |
| 52 | +@pytest.mark.parametrize( |
| 53 | + ("service_method", "expected_service_class"), |
| 54 | + [ |
| 55 | + ("attachments", AsyncInvoiceAttachmentsService), |
| 56 | + ], |
| 57 | +) |
| 58 | +def test_async_property_services(async_invoices_service, service_method, expected_service_class): |
| 59 | + service = getattr(async_invoices_service, service_method)("INV-0000-0001") |
| 60 | + |
| 61 | + assert isinstance(service, expected_service_class) |
| 62 | + assert service.endpoint_params == {"invoice_id": "INV-0000-0001"} |
0 commit comments