Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mpt_api_client/resources/accounts/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
AsyncCloudTenantsService,
CloudTenantsService,
)
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
Expand Down Expand Up @@ -76,6 +77,11 @@ def account_users(self) -> AccountUsersService:
"""Account Users service."""
return AccountUsersService(http_client=self.http_client)

@property
def erp_links(self) -> ErpLinksService:
"""ERP Links service."""
return ErpLinksService(http_client=self.http_client)


class AsyncAccounts:
"""Async Accounts MPT API Module."""
Expand Down Expand Up @@ -132,3 +138,8 @@ def buyers(self) -> AsyncBuyersService:
def account_users(self) -> AsyncAccountUsersService:
"""Account Users service."""
return AsyncAccountUsersService(http_client=self.http_client)

@property
def erp_links(self) -> AsyncErpLinksService:
"""ERP Links service."""
return AsyncErpLinksService(http_client=self.http_client)
41 changes: 41 additions & 0 deletions mpt_api_client/resources/accounts/erp_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from mpt_api_client.http import AsyncService, Service
from mpt_api_client.http.mixins import (
AsyncCreateMixin,
AsyncUpdateMixin,
CreateMixin,
UpdateMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.resources.accounts.mixins import AsyncBlockableMixin, BlockableMixin


class ErpLink(Model):
"""ERP Link Model."""


class ErpLinksServiceConfig:
"""ERP Links Service Configuration."""

_endpoint = "/public/v1/accounts/erp-links"
_model_class = ErpLink
_collection_key = "data"


class ErpLinksService(
CreateMixin[ErpLink],
UpdateMixin[ErpLink],
BlockableMixin[ErpLink],
Service[ErpLink],
ErpLinksServiceConfig,
):
"""ERP Links Service."""


class AsyncErpLinksService(
AsyncCreateMixin[ErpLink],
AsyncUpdateMixin[ErpLink],
AsyncBlockableMixin[ErpLink],
AsyncService[ErpLink],
ErpLinksServiceConfig,
):
"""Async ERP Links Service."""
3 changes: 3 additions & 0 deletions tests/resources/accounts/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AsyncCloudTenantsService,
CloudTenantsService,
)
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
Expand Down Expand Up @@ -48,6 +49,7 @@ def async_accounts(async_http_client):
("cloud_tenants", CloudTenantsService),
("buyers", BuyersService),
("account_users", AccountUsersService),
("erp_links", ErpLinksService),
],
)
def test_accounts_properties(accounts, property_name, expected_service_class):
Expand All @@ -71,6 +73,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class):
("cloud_tenants", AsyncCloudTenantsService),
("buyers", AsyncBuyersService),
("account_users", AsyncAccountUsersService),
("erp_links", AsyncErpLinksService),
],
)
def test_async_accounts_properties(async_accounts, property_name, expected_service_class):
Expand Down
29 changes: 29 additions & 0 deletions tests/resources/accounts/test_erp_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest

from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService


@pytest.fixture
def erp_links_service(http_client):
return ErpLinksService(http_client=http_client)


@pytest.fixture
def async_erp_links_service(async_http_client):
return AsyncErpLinksService(http_client=async_http_client)


@pytest.mark.parametrize(
"method",
["get", "create", "update", "block", "unblock"],
)
def test_mixins_present(erp_links_service, method):
assert hasattr(erp_links_service, method)


@pytest.mark.parametrize(
"method",
["get", "create", "update", "block", "unblock"],
)
def test_async_mixins_present(async_erp_links_service, method):
assert hasattr(async_erp_links_service, method)