Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion e2e_config.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
25 changes: 25 additions & 0 deletions tests/e2e/notifications/messages/conftest.py
Original file line number Diff line number Diff line change
@@ -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"
Comment on lines +23 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove unused e2e_config parameter from invalid_message_id

Ruff correctly flags e2e_config as unused here; the fixture always returns a constant invalid ID and no longer depends on config. You can simplify and quiet the warning:

 @pytest.fixture
-def invalid_message_id(e2e_config):
-    return "MSG-000-000-000-000"
+def invalid_message_id():
+    return "MSG-000-000-000-000"

This keeps the intent explicit and avoids an unnecessary fixture dependency.

🧰 Tools
🪛 Ruff (0.14.7)

24-24: Unused function argument: e2e_config

(ARG001)

🤖 Prompt for AI Agents
In tests/e2e/notifications/messages/conftest.py around lines 23–25, the pytest
fixture invalid_message_id includes an unused e2e_config parameter; remove
e2e_config from the fixture signature so it simply returns the constant
"MSG-000-000-000-000" and run tests/linters to confirm the Ruff warning is
resolved.

28 changes: 28 additions & 0 deletions tests/e2e/notifications/messages/test_async_messages.py
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 28 additions & 0 deletions tests/e2e/notifications/messages/test_sync_messages.py
Original file line number Diff line number Diff line change
@@ -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)