Skip to content

Commit 1795747

Browse files
authored
[MPT-14096] Added accounts erp links endpoints (#85)
Added accounts erp links endpoints https://softwareone.atlassian.net/browse/MPT-14096
2 parents 898faf5 + 21fa113 commit 1795747

4 files changed

Lines changed: 84 additions & 0 deletions

File tree

mpt_api_client/resources/accounts/accounts.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
AsyncCloudTenantsService,
1111
CloudTenantsService,
1212
)
13+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
1314
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
1415
from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService
1516
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
@@ -76,6 +77,11 @@ def account_users(self) -> AccountUsersService:
7677
"""Account Users service."""
7778
return AccountUsersService(http_client=self.http_client)
7879

80+
@property
81+
def erp_links(self) -> ErpLinksService:
82+
"""ERP Links service."""
83+
return ErpLinksService(http_client=self.http_client)
84+
7985

8086
class AsyncAccounts:
8187
"""Async Accounts MPT API Module."""
@@ -132,3 +138,8 @@ def buyers(self) -> AsyncBuyersService:
132138
def account_users(self) -> AsyncAccountUsersService:
133139
"""Account Users service."""
134140
return AsyncAccountUsersService(http_client=self.http_client)
141+
142+
@property
143+
def erp_links(self) -> AsyncErpLinksService:
144+
"""ERP Links service."""
145+
return AsyncErpLinksService(http_client=self.http_client)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from mpt_api_client.http import AsyncService, Service
2+
from mpt_api_client.http.mixins import (
3+
AsyncCreateMixin,
4+
AsyncUpdateMixin,
5+
CreateMixin,
6+
UpdateMixin,
7+
)
8+
from mpt_api_client.models import Model
9+
from mpt_api_client.resources.accounts.mixins import AsyncBlockableMixin, BlockableMixin
10+
11+
12+
class ErpLink(Model):
13+
"""ERP Link Model."""
14+
15+
16+
class ErpLinksServiceConfig:
17+
"""ERP Links Service Configuration."""
18+
19+
_endpoint = "/public/v1/accounts/erp-links"
20+
_model_class = ErpLink
21+
_collection_key = "data"
22+
23+
24+
class ErpLinksService(
25+
CreateMixin[ErpLink],
26+
UpdateMixin[ErpLink],
27+
BlockableMixin[ErpLink],
28+
Service[ErpLink],
29+
ErpLinksServiceConfig,
30+
):
31+
"""ERP Links Service."""
32+
33+
34+
class AsyncErpLinksService(
35+
AsyncCreateMixin[ErpLink],
36+
AsyncUpdateMixin[ErpLink],
37+
AsyncBlockableMixin[ErpLink],
38+
AsyncService[ErpLink],
39+
ErpLinksServiceConfig,
40+
):
41+
"""Async ERP Links Service."""

tests/resources/accounts/test_accounts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
AsyncCloudTenantsService,
1616
CloudTenantsService,
1717
)
18+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
1819
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
1920
from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService
2021
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
@@ -48,6 +49,7 @@ def async_accounts(async_http_client):
4849
("cloud_tenants", CloudTenantsService),
4950
("buyers", BuyersService),
5051
("account_users", AccountUsersService),
52+
("erp_links", ErpLinksService),
5153
],
5254
)
5355
def test_accounts_properties(accounts, property_name, expected_service_class):
@@ -71,6 +73,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class):
7173
("cloud_tenants", AsyncCloudTenantsService),
7274
("buyers", AsyncBuyersService),
7375
("account_users", AsyncAccountUsersService),
76+
("erp_links", AsyncErpLinksService),
7477
],
7578
)
7679
def test_async_accounts_properties(async_accounts, property_name, expected_service_class):
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import pytest
2+
3+
from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService
4+
5+
6+
@pytest.fixture
7+
def erp_links_service(http_client):
8+
return ErpLinksService(http_client=http_client)
9+
10+
11+
@pytest.fixture
12+
def async_erp_links_service(async_http_client):
13+
return AsyncErpLinksService(http_client=async_http_client)
14+
15+
16+
@pytest.mark.parametrize(
17+
"method",
18+
["get", "create", "update", "block", "unblock"],
19+
)
20+
def test_mixins_present(erp_links_service, method):
21+
assert hasattr(erp_links_service, method)
22+
23+
24+
@pytest.mark.parametrize(
25+
"method",
26+
["get", "create", "update", "block", "unblock"],
27+
)
28+
def test_async_mixins_present(async_erp_links_service, method):
29+
assert hasattr(async_erp_links_service, method)

0 commit comments

Comments
 (0)