diff --git a/mpt_api_client/resources/accounts/accounts.py b/mpt_api_client/resources/accounts/accounts.py index 8471f10e..7b5b843d 100644 --- a/mpt_api_client/resources/accounts/accounts.py +++ b/mpt_api_client/resources/accounts/accounts.py @@ -1,5 +1,6 @@ from mpt_api_client.http import AsyncHTTPClient, HTTPClient from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService +from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService @@ -25,6 +26,11 @@ def sellers(self) -> SellersService: """Sellers service.""" return SellersService(http_client=self.http_client) + @property + def licensees(self) -> LicenseesService: + """Licensees service.""" + return LicenseesService(http_client=self.http_client) + class AsyncAccounts: """Async Accounts MPT API Module.""" @@ -46,3 +52,8 @@ def users(self) -> AsyncUsersService: def sellers(self) -> AsyncSellersService: """Sellers service.""" return AsyncSellersService(http_client=self.http_client) + + @property + def licensees(self) -> AsyncLicenseesService: + """Licensees service.""" + return AsyncLicenseesService(http_client=self.http_client) diff --git a/mpt_api_client/resources/accounts/licensees.py b/mpt_api_client/resources/accounts/licensees.py new file mode 100644 index 00000000..86e98f25 --- /dev/null +++ b/mpt_api_client/resources/accounts/licensees.py @@ -0,0 +1,45 @@ +from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import ( + AsyncCreateMixin, + AsyncDeleteMixin, + AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + UpdateMixin, +) +from mpt_api_client.models import Model +from mpt_api_client.resources.accounts.mixins import AsyncEnablableMixin, EnablableMixin + + +class Licensee(Model): + """Licensee Model.""" + + +class LicenseesServiceConfig: + """Licensees Service Configuration.""" + + _endpoint = "/public/v1/accounts/licensees" + _model_class = Licensee + _collection_key = "data" + + +class LicenseesService( + CreateMixin[Licensee], + DeleteMixin, + UpdateMixin[Licensee], + EnablableMixin[Licensee], + Service[Licensee], + LicenseesServiceConfig, +): + """Licensees Service.""" + + +class AsyncLicenseesService( + AsyncCreateMixin[Licensee], + AsyncDeleteMixin, + AsyncUpdateMixin[Licensee], + AsyncEnablableMixin[Licensee], + AsyncService[Licensee], + LicenseesServiceConfig, +): + """Async Licensees Service.""" diff --git a/tests/resources/accounts/test_accounts.py b/tests/resources/accounts/test_accounts.py index 24d90f64..27432229 100644 --- a/tests/resources/accounts/test_accounts.py +++ b/tests/resources/accounts/test_accounts.py @@ -2,6 +2,7 @@ from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService from mpt_api_client.resources.accounts.accounts import Accounts, AsyncAccounts +from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService @@ -22,6 +23,7 @@ def async_accounts(async_http_client): ("accounts", AccountsService), ("users", UsersService), ("sellers", SellersService), + ("licensees", LicenseesService), ], ) def test_accounts_properties(accounts, property_name, expected_service_class): @@ -38,6 +40,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class): ("accounts", AsyncAccountsService), ("users", AsyncUsersService), ("sellers", AsyncSellersService), + ("licensees", AsyncLicenseesService), ], ) def test_async_accounts_properties(async_accounts, property_name, expected_service_class): diff --git a/tests/resources/accounts/test_licensees.py b/tests/resources/accounts/test_licensees.py new file mode 100644 index 00000000..62e9988c --- /dev/null +++ b/tests/resources/accounts/test_licensees.py @@ -0,0 +1,29 @@ +import pytest + +from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService + + +@pytest.fixture +def licensees_service(http_client): + return LicenseesService(http_client=http_client) + + +@pytest.fixture +def async_licensees_service(async_http_client): + return AsyncLicenseesService(http_client=async_http_client) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "delete", "update", "enable", "disable"], +) +def test_licensees_mixins_present(licensees_service, method): + assert hasattr(licensees_service, method) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "delete", "update", "enable", "disable"], +) +def test_async_licensees_mixins_present(async_licensees_service, method): + assert hasattr(async_licensees_service, method)