diff --git a/mpt_api_client/resources/accounts/accounts.py b/mpt_api_client/resources/accounts/accounts.py index 7b5b843d..f49298e3 100644 --- a/mpt_api_client/resources/accounts/accounts.py +++ b/mpt_api_client/resources/accounts/accounts.py @@ -2,6 +2,10 @@ 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.user_groups import ( + AsyncUserGroupsService, + UserGroupsService, +) from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService @@ -31,6 +35,11 @@ def licensees(self) -> LicenseesService: """Licensees service.""" return LicenseesService(http_client=self.http_client) + @property + def user_groups(self) -> UserGroupsService: + """User Groups service.""" + return UserGroupsService(http_client=self.http_client) + class AsyncAccounts: """Async Accounts MPT API Module.""" @@ -57,3 +66,8 @@ def sellers(self) -> AsyncSellersService: def licensees(self) -> AsyncLicenseesService: """Licensees service.""" return AsyncLicenseesService(http_client=self.http_client) + + @property + def user_groups(self) -> AsyncUserGroupsService: + """User Groups service.""" + return AsyncUserGroupsService(http_client=self.http_client) diff --git a/mpt_api_client/resources/accounts/user_groups.py b/mpt_api_client/resources/accounts/user_groups.py new file mode 100644 index 00000000..00a8f992 --- /dev/null +++ b/mpt_api_client/resources/accounts/user_groups.py @@ -0,0 +1,42 @@ +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 + + +class UserGroup(Model): + """User Group resource.""" + + +class UserGroupsServiceConfig: + """User Groups service configuration.""" + + _endpoint = "/public/v1/accounts/user-groups" + _model_class = UserGroup + _collection_key = "data" + + +class UserGroupsService( + CreateMixin[UserGroup], + UpdateMixin[UserGroup], + DeleteMixin, + Service[UserGroup], + UserGroupsServiceConfig, +): + """User Groups service.""" + + +class AsyncUserGroupsService( + AsyncCreateMixin[UserGroup], + AsyncUpdateMixin[UserGroup], + AsyncDeleteMixin, + AsyncService[UserGroup], + UserGroupsServiceConfig, +): + """Async User Groups service.""" diff --git a/tests/resources/accounts/test_accounts.py b/tests/resources/accounts/test_accounts.py index 27432229..3b5d092f 100644 --- a/tests/resources/accounts/test_accounts.py +++ b/tests/resources/accounts/test_accounts.py @@ -4,6 +4,10 @@ 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.user_groups import ( + AsyncUserGroupsService, + UserGroupsService, +) from mpt_api_client.resources.accounts.users import AsyncUsersService, UsersService @@ -24,6 +28,7 @@ def async_accounts(async_http_client): ("users", UsersService), ("sellers", SellersService), ("licensees", LicenseesService), + ("user_groups", UserGroupsService), ], ) def test_accounts_properties(accounts, property_name, expected_service_class): @@ -41,6 +46,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class): ("users", AsyncUsersService), ("sellers", AsyncSellersService), ("licensees", AsyncLicenseesService), + ("user_groups", AsyncUserGroupsService), ], ) def test_async_accounts_properties(async_accounts, property_name, expected_service_class): diff --git a/tests/resources/accounts/test_user_groups.py b/tests/resources/accounts/test_user_groups.py new file mode 100644 index 00000000..a45934e7 --- /dev/null +++ b/tests/resources/accounts/test_user_groups.py @@ -0,0 +1,32 @@ +import pytest + +from mpt_api_client.resources.accounts.user_groups import ( + AsyncUserGroupsService, + UserGroupsService, +) + + +@pytest.fixture +def user_groups_service(http_client): + return UserGroupsService(http_client=http_client) + + +@pytest.fixture +def async_user_groups_service(http_client): + return AsyncUserGroupsService(http_client=http_client) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "delete"], +) +def test_mixins_present(user_groups_service, method): + assert hasattr(user_groups_service, method) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "delete"], +) +def test_async_mixins_present(async_user_groups_service, method): + assert hasattr(async_user_groups_service, method)