diff --git a/e2e_config.test.json b/e2e_config.test.json index 05aaa04..df53b3b 100644 --- a/e2e_config.test.json +++ b/e2e_config.test.json @@ -20,5 +20,6 @@ "catalog.product.template.id": "TPL-7255-3950-0001", "catalog.product.terms.id": "TCS-7255-3950-0001", "catalog.product.terms.variant.id": "TCV-7255-3950-0001-0001", - "catalog.unit.id": "UNT-1229" + "catalog.unit.id": "UNT-1229", + "notifications.message.id": "MSG-0000-6215-1019-0139" } diff --git a/tests/e2e/notifications/messages/conftest.py b/tests/e2e/notifications/messages/conftest.py new file mode 100644 index 0000000..9cc5b91 --- /dev/null +++ b/tests/e2e/notifications/messages/conftest.py @@ -0,0 +1,25 @@ +import pytest + + +@pytest.fixture +def message_data(short_uuid, account_id): + return { + "title": "e2e - please delete", + "content": "This is an e2e test message - please delete", + "category": "general", + "priority": "normal", + "account": { + "id": account_id, + }, + "externalIds": {"test": f"e2e-delete-{short_uuid}"}, + } + + +@pytest.fixture +def message_id(e2e_config): + return e2e_config.get("notifications.message.id") + + +@pytest.fixture +def invalid_message_id(e2e_config): + return "MSG-000-000-000-000" diff --git a/tests/e2e/notifications/messages/test_async_messages.py b/tests/e2e/notifications/messages/test_async_messages.py new file mode 100644 index 0000000..495c3a2 --- /dev/null +++ b/tests/e2e/notifications/messages/test_async_messages.py @@ -0,0 +1,28 @@ +import pytest + +from mpt_api_client.exceptions import MPTAPIError + +pytestmark = [pytest.mark.flaky] + + +async def test_get_message(async_mpt_client, message_id): + service = async_mpt_client.notifications.messages + + result = await service.get(message_id) + + assert result.id == message_id + + +async def test_list_messages(async_mpt_ops): + service = async_mpt_ops.notifications.messages + + result = await service.fetch_page(limit=1) + + assert len(result) > 0 + + +async def test_not_found(async_mpt_client, invalid_message_id): + service = async_mpt_client.notifications.messages + + with pytest.raises(MPTAPIError): + await service.get(invalid_message_id) diff --git a/tests/e2e/notifications/messages/test_sync_messages.py b/tests/e2e/notifications/messages/test_sync_messages.py new file mode 100644 index 0000000..3dc0de7 --- /dev/null +++ b/tests/e2e/notifications/messages/test_sync_messages.py @@ -0,0 +1,28 @@ +import pytest + +from mpt_api_client.exceptions import MPTAPIError + +pytestmark = [pytest.mark.flaky] + + +def test_get_message(mpt_client, message_id): + service = mpt_client.notifications.messages + + result = service.get(message_id) + + assert result.id == message_id + + +def test_list_messages(mpt_ops): + service = mpt_ops.notifications.messages + + result = service.fetch_page(limit=1) + + assert len(result) > 0 + + +def test_not_found(mpt_client, invalid_message_id): + service = mpt_client.notifications.messages + + with pytest.raises(MPTAPIError): + service.get(invalid_message_id)