Skip to content

Commit 8d4d42b

Browse files
author
Robert Segal
committed
Added Accounts licensees endpoints
1 parent cb52d93 commit 8d4d42b

4 files changed

Lines changed: 88 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
@@ -2,6 +2,7 @@
22
from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService
33
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
44
from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService
5+
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
56

67

78
class Accounts:
@@ -25,6 +26,11 @@ def sellers(self) -> SellersService:
2526
"""Sellers service."""
2627
return SellersService(http_client=self.http_client)
2728

29+
@property
30+
def licensees(self) -> LicenseesService:
31+
"""Licensees service."""
32+
return LicenseesService(http_client=self.http_client)
33+
2834

2935
class AsyncAccounts:
3036
"""Async Accounts MPT API Module."""
@@ -46,3 +52,8 @@ def users(self) -> AsyncUsersService:
4652
def sellers(self) -> AsyncSellersService:
4753
"""Sellers service."""
4854
return AsyncSellersService(http_client=self.http_client)
55+
56+
@property
57+
def licensees(self) -> AsyncLicenseesService:
58+
"""Licensees service."""
59+
return AsyncLicenseesService(http_client=self.http_client)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from mpt_api_client.http import AsyncService, Service
2+
from mpt_api_client.http.mixins import (
3+
AsyncCreateMixin,
4+
AsyncDeleteMixin,
5+
AsyncUpdateMixin,
6+
CreateMixin,
7+
DeleteMixin,
8+
UpdateMixin,
9+
)
10+
from mpt_api_client.models import Model
11+
from mpt_api_client.resources.accounts.mixins import AsyncEnablableMixin, EnablableMixin
12+
13+
14+
class Licensee(Model):
15+
"""Licensee Model."""
16+
17+
18+
class LicenseesServiceConfig:
19+
"""Licensees Service Configuration."""
20+
21+
_endpoint = "/public/v1/accounts/licensees"
22+
_model_class = Licensee
23+
_collection_key = "data"
24+
25+
26+
class LicenseesService(
27+
CreateMixin[Licensee],
28+
DeleteMixin,
29+
UpdateMixin[Licensee],
30+
EnablableMixin[Licensee],
31+
Service[Licensee],
32+
LicenseesServiceConfig,
33+
):
34+
"""Licensees Service."""
35+
36+
37+
class AsyncLicenseesService(
38+
AsyncCreateMixin[Licensee],
39+
AsyncDeleteMixin,
40+
AsyncUpdateMixin[Licensee],
41+
AsyncEnablableMixin[Licensee],
42+
AsyncService[Licensee],
43+
LicenseesServiceConfig,
44+
):
45+
"""Async Licensees Service."""

tests/resources/accounts/test_accounts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from mpt_api_client.resources.accounts.accounts import Accounts, AsyncAccounts
55
from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService
66
from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService
7+
from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService
78

89

910
@pytest.fixture
@@ -22,6 +23,7 @@ def async_accounts(async_http_client):
2223
("accounts", AccountsService),
2324
("users", UsersService),
2425
("sellers", SellersService),
26+
("licensees", LicenseesService),
2527
],
2628
)
2729
def test_accounts_properties(accounts, property_name, expected_service_class):
@@ -38,6 +40,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class):
3840
("accounts", AsyncAccountsService),
3941
("users", AsyncUsersService),
4042
("sellers", AsyncSellersService),
43+
("licensees", AsyncLicenseesService),
4144
],
4245
)
4346
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.licensees import AsyncLicenseesService, LicenseesService
4+
5+
6+
@pytest.fixture
7+
def licensees_service(http_client):
8+
return LicenseesService(http_client=http_client)
9+
10+
11+
@pytest.fixture
12+
def async_licensees_service(async_http_client):
13+
return AsyncLicenseesService(http_client=async_http_client)
14+
15+
16+
@pytest.mark.parametrize(
17+
"method",
18+
["get", "create", "delete", "update", "enable", "disable"],
19+
)
20+
def test_licensees_mixins_present(licensees_service, method):
21+
assert hasattr(licensees_service, method)
22+
23+
24+
@pytest.mark.parametrize(
25+
"method",
26+
["get", "create", "delete", "update", "enable", "disable"],
27+
)
28+
def test_async_licensees_mixins_present(async_licensees_service, method):
29+
assert hasattr(async_licensees_service, method)

0 commit comments

Comments
 (0)