Skip to content

Commit 597f15a

Browse files
committed
MPT-14863 E2E for notifications accounts categories contacts
1 parent aa89e23 commit 597f15a

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

mpt_api_client/resources/notifications/accounts.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpt_api_client.exceptions import MPTError
22
from mpt_api_client.http import AsyncService, Service
3+
from mpt_api_client.http.mixins import AsyncCollectionMixin, CollectionMixin
34
from mpt_api_client.models import Model
45

56

@@ -14,14 +15,16 @@ class Contact(Model):
1415
class AccountsServiceConfig:
1516
"""Accounts service config."""
1617

17-
_endpoint = "/public/v1/commerce/accounts/{account_id}/categories/{category_id}/contacts"
18+
_endpoint = "/public/v1/notifications/accounts/{account_id}/categories/{category_id}/contacts"
1819
_model_class = Contact
1920
_collection_key = "data"
2021

2122

22-
class AccountsService(Service[Contact], AccountsServiceConfig):
23+
class AccountsService(CollectionMixin[Contact], Service[Contact], AccountsServiceConfig):
2324
"""Accounts service."""
2425

2526

26-
class AsyncAccountsService(AsyncService[Contact], AccountsServiceConfig):
27+
class AsyncAccountsService(
28+
AsyncCollectionMixin[Contact], AsyncService[Contact], AccountsServiceConfig
29+
):
2730
"""Async Accounts service."""
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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)

tests/unit/resources/notifications/test_accounts.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,17 @@ def accounts_service(http_client):
1414
@pytest.fixture
1515
def 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_batches_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_batches_service_methods(async_accounts_service, method):
28+
result = hasattr(async_accounts_service, method)
29+
30+
assert result is True

0 commit comments

Comments
 (0)