File tree Expand file tree Collapse file tree 4 files changed +43
-6
lines changed
mpt_api_client/resources/notifications
e2e/notifications/accounts
unit/resources/notifications Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 11from mpt_api_client .exceptions import MPTError
22from mpt_api_client .http import AsyncService , Service
3+ from mpt_api_client .http .mixins import AsyncCollectionMixin , CollectionMixin
34from mpt_api_client .models import Model
45
56
67class MethodNotAllowedError (MPTError ):
78 """Method not allowed error."""
89
910
10- class Contact (Model ):
11- """Account resource."""
11+ class NotificationContact (Model ):
12+ """Notification Contact resource."""
1213
1314
1415class AccountsServiceConfig :
1516 """Accounts service config."""
1617
17- _endpoint = "/public/v1/commerce /accounts/{account_id}/categories/{category_id}/contacts"
18- _model_class = Contact
18+ _endpoint = "/public/v1/notifications /accounts/{account_id}/categories/{category_id}/contacts"
19+ _model_class = NotificationContact
1920 _collection_key = "data"
2021
2122
22- class AccountsService (Service [Contact ], AccountsServiceConfig ):
23+ class AccountsService (
24+ CollectionMixin [NotificationContact ], Service [NotificationContact ], AccountsServiceConfig
25+ ):
2326 """Accounts service."""
2427
2528
26- class AsyncAccountsService (AsyncService [Contact ], AccountsServiceConfig ):
29+ class AsyncAccountsService (
30+ AsyncCollectionMixin [NotificationContact ],
31+ AsyncService [NotificationContact ],
32+ AccountsServiceConfig ,
33+ ):
2734 """Async Accounts service."""
Original file line number Diff line number Diff line change 1+ async def test_async_accounts (async_mpt_ops , account_id , category_id ):
2+ iterator = async_mpt_ops .notifications .accounts (
3+ account_id = account_id , category_id = category_id
4+ ).iterate ()
5+
6+ result = [contact async for contact in iterator ]
7+
8+ assert isinstance (result , list )
Original file line number Diff line number Diff line change 1+ def test_accounts (mpt_ops , account_id , category_id ):
2+ iterator = mpt_ops .notifications .accounts (
3+ account_id = account_id , category_id = category_id
4+ ).iterate ()
5+
6+ result = list (iterator )
7+
8+ assert isinstance (result , list )
Original file line number Diff line number Diff line change @@ -14,3 +14,17 @@ def accounts_service(http_client):
1414@pytest .fixture
1515def async_accounts_service (async_http_client ):
1616 return AsyncAccountsService (http_client = async_http_client )
17+
18+
19+ @pytest .mark .parametrize ("method" , ["iterate" ])
20+ def test_sync_accounts_service_methods (accounts_service , method ):
21+ result = hasattr (accounts_service , method )
22+
23+ assert result is True
24+
25+
26+ @pytest .mark .parametrize ("method" , ["iterate" ])
27+ def test_async_accounts_service_methods (async_accounts_service , method ):
28+ result = hasattr (async_accounts_service , method )
29+
30+ assert result is True
You can’t perform that action at this time.
0 commit comments