Skip to content

Conversation

@jentyk
Copy link
Contributor

@jentyk jentyk commented Nov 28, 2025

Summary by CodeRabbit

  • Tests

    • Added end-to-end sync and async tests for message retrieval, listing (pagination) and not-found error handling.
    • Introduced test fixtures supplying message data, valid/invalid message IDs, and related helpers; some tests marked flaky to reflect intermittency.
  • Chores

    • Updated notification configuration with a new message identifier.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

Added an e2e configuration key for a message ID and introduced pytest fixtures plus synchronous and asynchronous end-to-end tests for the notifications/messages API (including success, pagination, and not-found cases).

Changes

Cohort / File(s) Summary
Configuration
e2e_config.test.json
Added top-level key notifications.message.id with value "MSG-0000-6215-1019-0139" and adjusted surrounding punctuation for valid JSON.
Test Fixtures
tests/e2e/notifications/messages/conftest.py
New pytest fixtures: message_data(short_uuid, account_id) returns structured message payload; message_id(e2e_config) returns configured message ID; invalid_message_id(e2e_config) returns a malformed ID for error tests.
Test Modules
tests/e2e/notifications/messages/test_async_messages.py, tests/e2e/notifications/messages/test_sync_messages.py
New e2e tests (async and sync) covering: test_get_message (fetch by ID), test_list_messages (pagination, limit=1), and test_not_found (invalid ID raises MPTAPIError). Tests are marked flaky.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Check fixture wiring and dependency names (short_uuid, account_id, e2e_config).
  • Verify notifications.message.id value usage and existence in config.
  • Confirm assertions and exception expectations (MPTAPIError) align with API behavior.

Suggested reviewers

  • d3rky
  • svazquezco
  • alephsur
  • ruben-sebrango

Poem

🐰
I hopped into configs, tidy and spry,
Brought fixtures and tests that leap to the sky,
Sync and async, I nudge them to play,
Messages counted, then sent on their way,
A tiny rabbit, cheering the CI today.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding end-to-end tests for the notifications messages endpoint, which aligns with the actual changes across all modified files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/MPT-14935

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

✅ Found Jira issue key in the title: MPT-14935

Generated by 🚫 dangerJS against 33d5413

@jentyk jentyk marked this pull request as ready for review December 1, 2025 09:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/e2e/notifications/messages/test_async_messages.py (1)

8-27: Align async test_get_message behavior with sync test when message_id is missing

Right now, if message_id is not configured (fixture returns None), test_get_message will try to call service.get(None) and fail rather than skipping like the sync test does. To keep behavior consistent and make tests robust to missing config, consider:

 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
+    if message_id is None:
+        pytest.skip("Message ID not configured in e2e_config")
+
+    service = async_mpt_client.notifications.messages
+
+    result = await service.get(message_id)
+
+    assert result.id == message_id

The other async tests look fine and will benefit from the invalid_message_id fixture fix suggested in the conftest review.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 416dec4 and 1fcd75f.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/accounts/conftest.py (0 hunks)
  • tests/e2e/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/test_async_messages.py (1 hunks)
  • tests/e2e/notifications/messages/test_sync_messages.py (1 hunks)
💤 Files with no reviewable changes (1)
  • tests/e2e/accounts/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.332Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/conftest.py:0-0
Timestamp: 2025-11-27T00:05:36.332Z
Learning: When reviewing PRs that add fixtures to a parent conftest that may duplicate fixtures in child conftest files, do not suggest removing the duplicates from child conftest files that are outside the scope of the PR's changes.

Applied to files:

  • tests/e2e/notifications/messages/conftest.py
🧬 Code graph analysis (2)
tests/e2e/notifications/messages/test_sync_messages.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/conftest.py (2)
  • mpt_client (43-44)
  • mpt_ops (31-32)
tests/e2e/notifications/messages/conftest.py (2)
  • message_id (19-20)
  • invalid_message_id (24-25)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/messages/conftest.py (1)
tests/e2e/conftest.py (3)
  • short_uuid (101-102)
  • account_id (122-123)
  • e2e_config (89-92)
🪛 GitHub Actions: PR build and merge
tests/e2e/notifications/messages/test_sync_messages.py

[error] 11-11: wemake-python-styleguide: AAA05 blank line in block. Run lint to fix style; associated with test_sync_messages.py. Command step: docker compose run --service-ports app_test

🔇 Additional comments (2)
e2e_config.test.json (1)

23-24: Config entry for notifications.message.id matches fixture usage

The new notifications.message.id key is consistent with the fixtures and keeps the JSON valid after adding the trailing comma on the preceding line. No issues here.

tests/e2e/conftest.py (1)

121-123: Centralizing account_id fixture at top-level conftest looks good

The account_id fixture mirrors the existing user_id pattern and correctly pulls from e2e_config["accounts.account.id"], making it reusable across E2E tests.

@jentyk jentyk force-pushed the feat/MPT-14935 branch 2 times, most recently from 4fc33c8 to 9b6d2ad Compare December 1, 2025 10:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/e2e/notifications/messages/conftest.py (2)

18-20: Prefer direct dictionary access for consistency and clearer errors.

The message_id fixture uses .get(), which silently returns None if the key is missing, potentially causing confusing test failures downstream. For consistency with the account_id fixture pattern (which uses e2e_config["accounts.account.id"]) and to get immediate, clear feedback when required config is missing, use direct dictionary access.

Apply this diff:

 @pytest.fixture
 def message_id(e2e_config):
-    return e2e_config.get("notifications.message.id")
+    return e2e_config["notifications.message.id"]

23-25: Remove unused e2e_config parameter.

The invalid_message_id fixture returns a hard-coded value and doesn't use the e2e_config parameter.

Apply this diff:

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

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fcd75f and 9b6d2ad.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/accounts/conftest.py (0 hunks)
  • tests/e2e/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/test_async_messages.py (1 hunks)
  • tests/e2e/notifications/messages/test_sync_messages.py (1 hunks)
💤 Files with no reviewable changes (1)
  • tests/e2e/accounts/conftest.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • e2e_config.test.json
  • tests/e2e/notifications/messages/test_async_messages.py
  • tests/e2e/conftest.py
  • tests/e2e/notifications/messages/test_sync_messages.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.332Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/conftest.py:0-0
Timestamp: 2025-11-27T00:05:36.332Z
Learning: When reviewing PRs that add fixtures to a parent conftest that may duplicate fixtures in child conftest files, do not suggest removing the duplicates from child conftest files that are outside the scope of the PR's changes.

Applied to files:

  • tests/e2e/notifications/messages/conftest.py
🧬 Code graph analysis (1)
tests/e2e/notifications/messages/conftest.py (1)
tests/e2e/conftest.py (3)
  • short_uuid (101-102)
  • account_id (122-123)
  • e2e_config (89-92)
🪛 Ruff (0.14.6)
tests/e2e/notifications/messages/conftest.py

24-24: Unused function argument: e2e_config

(ARG001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
tests/e2e/notifications/messages/conftest.py (1)

4-15: LGTM!

The message_data fixture is well-structured with appropriate test data and correct fixture dependencies.

Copy link
Contributor

@albertsola albertsola left a comment

Choose a reason for hiding this comment

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

Not 100% sure about moving account_id a level up.

@jentyk jentyk force-pushed the feat/MPT-14935 branch 2 times, most recently from b591c76 to ed3b678 Compare December 2, 2025 10:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
tests/e2e/notifications/messages/conftest.py (1)

23-25: Remove unused e2e_config argument from invalid_message_id fixture

e2e_config isn’t used here and Ruff flags it as ARG001, so this fixture needn’t depend on that fixture at all.

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

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6d2ad and ed3b678.

📒 Files selected for processing (4)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/notifications/messages/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/test_async_messages.py (1 hunks)
  • tests/e2e/notifications/messages/test_sync_messages.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/e2e/notifications/messages/test_sync_messages.py
  • e2e_config.test.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.332Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/conftest.py:0-0
Timestamp: 2025-11-27T00:05:36.332Z
Learning: When reviewing PRs that add fixtures to a parent conftest that may duplicate fixtures in child conftest files, do not suggest removing the duplicates from child conftest files that are outside the scope of the PR's changes.

Applied to files:

  • tests/e2e/notifications/messages/conftest.py
🧬 Code graph analysis (2)
tests/e2e/notifications/messages/test_async_messages.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/notifications/messages/test_sync_messages.py (3)
  • test_get_message (8-15)
  • test_list_messages (18-23)
  • test_not_found (26-30)
tests/e2e/conftest.py (2)
  • async_mpt_client (48-51)
  • async_mpt_ops (36-39)
tests/e2e/notifications/messages/conftest.py (2)
  • message_id (19-20)
  • invalid_message_id (24-25)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/messages/conftest.py (2)
tests/e2e/conftest.py (2)
  • short_uuid (101-102)
  • e2e_config (89-92)
tests/e2e/accounts/conftest.py (1)
  • account_id (22-23)
🪛 Ruff (0.14.7)
tests/e2e/notifications/messages/conftest.py

24-24: Unused function argument: e2e_config

(ARG001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
tests/e2e/notifications/messages/test_async_messages.py (1)

16-28: Async list/not-found coverage looks solid and mirrors sync tests

The test_list_messages and test_not_found cases correctly exercise page fetching and 404 handling via MPTAPIError, matching the sync behaviors with the async client.

tests/e2e/notifications/messages/conftest.py (2)

4-15: message_data fixture is clear and reusable

Payload structure (title/content/category/priority/account/externalIds) looks good for E2E creation and later cleanup via the short UUID tag.


18-20: message_id fixture matches optional-config pattern

Using .get("notifications.message.id") is consistent with tests that skip when the ID is not configured, keeping the fixture flexible across environments.

@jentyk
Copy link
Contributor Author

jentyk commented Dec 2, 2025

Not 100% sure about moving account_id a level up.

reverted

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/e2e/notifications/messages/conftest.py (1)

18-20: Consider failing fast if notifications.message.id is missing

Elsewhere (e.g., account_id in tests/e2e/accounts/conftest.py) the config is accessed with [], which will fail loudly if the key is missing. For consistency and clearer failures, you might prefer:

 @pytest.fixture
 def message_id(e2e_config):
-    return e2e_config.get("notifications.message.id")
+    return e2e_config["notifications.message.id"]

This is optional, but it keeps behavior consistent across fixtures and surfaces misconfigured test environments earlier.

Please confirm that all your test configs define "notifications.message.id" before applying this change.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed3b678 and 33d5413.

📒 Files selected for processing (4)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/notifications/messages/conftest.py (1 hunks)
  • tests/e2e/notifications/messages/test_async_messages.py (1 hunks)
  • tests/e2e/notifications/messages/test_sync_messages.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/e2e/notifications/messages/test_sync_messages.py
  • tests/e2e/notifications/messages/test_async_messages.py
  • e2e_config.test.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.332Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/conftest.py:0-0
Timestamp: 2025-11-27T00:05:36.332Z
Learning: When reviewing PRs that add fixtures to a parent conftest that may duplicate fixtures in child conftest files, do not suggest removing the duplicates from child conftest files that are outside the scope of the PR's changes.

Applied to files:

  • tests/e2e/notifications/messages/conftest.py
🧬 Code graph analysis (1)
tests/e2e/notifications/messages/conftest.py (2)
tests/e2e/conftest.py (2)
  • short_uuid (101-102)
  • e2e_config (89-92)
tests/e2e/accounts/conftest.py (1)
  • account_id (22-23)
🪛 Ruff (0.14.7)
tests/e2e/notifications/messages/conftest.py

24-24: Unused function argument: e2e_config

(ARG001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
tests/e2e/notifications/messages/conftest.py (1)

4-15: message_data fixture looks good and reusable

The payload shape and use of short_uuid and account_id are clear and appropriate for E2E tests; no changes needed.

Comment on lines +23 to +25
@pytest.fixture
def invalid_message_id(e2e_config):
return "MSG-000-000-000-000"
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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

@jentyk jentyk merged commit 8f72e0c into main Dec 2, 2025
6 checks passed
@jentyk jentyk deleted the feat/MPT-14935 branch December 2, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants