Skip to content

Conversation

@albertsola
Copy link
Contributor

@albertsola albertsola commented Dec 5, 2025

Summary by CodeRabbit

  • Tests
    • Added comprehensive end-to-end test coverage (sync and async) for catalog listings: creation, retrieval, filtering, not-found handling, updates, and deletion.
    • Introduced new test fixtures and test data for catalog listings: authorization id, price list id, listing id, listing payload, listings service, and managed created listings.
  • Chores
    • Updated end-to-end configuration to add catalog.* identifiers (including price list and related IDs) while retaining existing commerce.* identifiers and reordered keys for coexistence.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Walkthrough

Adds catalog-specific config keys and new pytest fixtures, plus synchronous and asynchronous end-to-end tests for catalog listings (create, get, filter, not-found, update, delete), wiring fixtures for authorization, listing, and price-list identifiers.

Changes

Cohort / File(s) Summary
Configuration
e2e_config.test.json
Introduces catalog.* identifiers (e.g., catalog.authorization.id, catalog.listing.id, catalog.product.id, catalog.product.item.id, catalog.price_list.id) while retaining/reordering commerce.* entries so both sections coexist.
Top-level fixtures
tests/e2e/conftest.py
Adds price_list_id fixture returning e2e_config["catalog.price_list.id"].
Catalog fixtures
tests/e2e/catalog/conftest.py
Adds authorization_id and price_list_id fixtures returning e2e_config["catalog.authorization.id"] and e2e_config["catalog.price_list.id"].
Listings fixtures
tests/e2e/catalog/listings/conftest.py
Adds listing_id fixture (e2e_config["catalog.listing.id"]) and listing_data fixture that builds a listing payload including authorization, product, vendor, seller, priceList, primary, notes, and eligibility.
Sync listings tests
tests/e2e/catalog/listings/test_sync_listings.py
New synchronous E2E tests and fixtures covering create, get-by-id, filter/iterate, not-found (expects MPTAPIError 404), update, and delete flows; uses lifecycle helpers.
Async listings tests
tests/e2e/catalog/listings/test_async_listings.py
New asynchronous E2E tests mirroring sync tests, using async service fixture and async resource lifecycle helpers; covers create, get, filter, not-found, and update flows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify fixture names/returns and cross-file wiring of e2e_config[...] keys.
  • Confirm listing_data["priceList"] shape matches API expectations.
  • Inspect async vs sync lifecycle helpers for consistent setup/teardown.
  • Check MPTAPIError 404 assertions and cleanup behavior in tests.

Possibly related PRs

Suggested reviewers

  • d3rky
  • jentyk
  • alephsur
  • ruben-sebrango
  • svazquezco

Poem

🐰 I hopped through keys and fixtures bright,

Listings made in day and night,
Synced and async, tidy and neat,
Price lists, authors — all complete.
A tiny rabbit's testing treat 🥕

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 'MPT-14897 E2E Catalog listings' clearly indicates the main purpose of the changes: adding end-to-end tests for catalog listings functionality, which aligns with the changeset that introduces test fixtures and multiple test modules for catalog listings.
✨ 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 e2e/catalog/MPT-14897-catalog-listings

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

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

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

Generated by 🚫 dangerJS against c9a22d6

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: 3

🧹 Nitpick comments (1)
tests/e2e/catalog/listings/conftest.py (1)

14-34: Use price_list_id fixture instead of hardcoded value.

The listing_data fixture hardcodes the price list ID "PRC-7255-3950-0245" on line 30. Since a price_list_id fixture was added in tests/e2e/conftest.py (lines 146-148) that retrieves this value from the configuration, use that fixture for consistency and maintainability. Also, the inline comment on line 25 is unnecessary since the value is already provided via fixture.

Apply this diff:

 @pytest.fixture
-def listing_data(authorization_id, product_id, account_id, seller_id):
+def listing_data(authorization_id, product_id, account_id, seller_id, price_list_id):
     return {
         "name": "e2e - please delete",
         "authorization": {
             "id": authorization_id,
         },
         "product": {
             "id": product_id,
         },
         "vendor": {
-            "id": account_id,  # "ACC-9042-0088",
+            "id": account_id,
         },
         "seller": {
             "id": seller_id,
         },
-        "priceList": {"id": "PRC-7255-3950-0245"},
+        "priceList": {"id": price_list_id},
         "primary": False,
         "notes": "",
         "eligibility": {"client": True, "partner": False},
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff6b291 and af9b083.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
tests/e2e/catalog/conftest.py (1)
tests/e2e/conftest.py (2)
  • authorization_id (142-143)
  • e2e_config (89-92)
tests/e2e/catalog/listings/conftest.py (3)
tests/e2e/catalog/listings/test_sync_listings.py (1)
  • listings_service (11-12)
tests/e2e/conftest.py (6)
  • mpt_ops (31-32)
  • e2e_config (89-92)
  • authorization_id (142-143)
  • product_id (96-97)
  • account_id (122-123)
  • seller_id (127-128)
tests/e2e/catalog/conftest.py (1)
  • authorization_id (20-21)
tests/e2e/catalog/listings/test_async_listings.py (5)
tests/e2e/helper.py (2)
  • assert_async_update_resource (62-68)
  • async_create_fixture_resource_and_delete (8-16)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • product_id (96-97)
tests/e2e/catalog/listings/conftest.py (2)
  • listing_data (15-34)
  • listing_id (10-11)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 GitHub Actions: PR build and merge
tests/e2e/catalog/listings/test_async_listings.py

[error] 2-2: ModuleNotFoundError: No module named 'e2e' while importing tests/e2e/catalog/listings/test_async_listings.py

tests/e2e/catalog/listings/test_sync_listings.py

[error] 2-2: ModuleNotFoundError: No module named 'e2e' while importing tests/e2e/catalog/listings/test_sync_listings.py

🪛 Ruff (0.14.7)
tests/e2e/catalog/listings/test_async_listings.py

23-23: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/catalog/listings/test_sync_listings.py

21-21: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (6)
tests/e2e/conftest.py (1)

146-148: LGTM!

The fixture follows the established pattern for retrieving configuration values and will be useful for catalog listings tests.

e2e_config.test.json (1)

14-33: LGTM!

The configuration properly introduces catalog-specific identifiers while maintaining existing commerce identifiers, supporting both namespaces for the E2E test suite.

tests/e2e/catalog/listings/test_sync_listings.py (2)

21-21: Remove unused noqa directive.

The noqa: AAA01 directive is not recognized by the configured linters and should be removed.

Apply this diff:

-def test_create_listing(created_listing, product_id):  # noqa: AAA01
+def test_create_listing(created_listing, product_id):
     assert created_listing.product.id == product_id
⛔ Skipped due to learnings
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 136
File: tests/e2e/notifications/subscribers/conftest.py:14-25
Timestamp: 2025-12-01T10:48:52.586Z
Learning: The repository softwareone-platform/mpt-api-python-client uses wemake-python-styleguide linter, so noqa directives for WPS rules should not be flagged as unused.

10-12: Remove duplicate fixture definition.

The listings_service fixture is already defined in tests/e2e/catalog/listings/conftest.py (lines 4-6) with the exact same implementation. Remove this duplicate definition to avoid confusion and potential fixture resolution issues.

Apply this diff:

-@pytest.fixture
-def listings_service(mpt_ops):
-    return mpt_ops.catalog.listings
-
-
⛔ Skipped due to learnings
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.356Z
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.
tests/e2e/catalog/listings/test_async_listings.py (2)

23-24: Sync test function cannot use async fixture.

The test_create_listing function is not declared as async, but it depends on async_created_listing, which is an async fixture. Pytest requires test functions that consume async fixtures to be declared as async.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+async def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
⛔ Skipped due to learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.701Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

23-23: Remove unused noqa directive.

The noqa: AAA01 directive is not recognized by the configured linters and should be removed.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+async def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
⛔ Skipped due to learnings
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 136
File: tests/e2e/notifications/subscribers/conftest.py:14-25
Timestamp: 2025-12-01T10:48:52.586Z
Learning: The repository softwareone-platform/mpt-api-python-client uses wemake-python-styleguide linter, so noqa directives for WPS rules should not be flagged as unused.

Comment on lines +19 to +21
@pytest.fixture
def authorization_id(e2e_config):
return e2e_config["catalog.authorization.id"]
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

Duplicate fixture name creates shadowing and confusion.

This authorization_id fixture shadows an existing fixture in tests/e2e/conftest.py (lines 141-142) that retrieves commerce.authorization.id. While pytest's scoping means this catalog-specific version will take precedence within the tests/e2e/catalog/ directory, having two fixtures with the same name retrieving different configuration keys is confusing and error-prone.

Consider renaming one of these fixtures (e.g., catalog_authorization_id vs commerce_authorization_id) to make the distinction explicit and prevent unintended fixture resolution.

🤖 Prompt for AI Agents
In tests/e2e/catalog/conftest.py around lines 19-21, the fixture
authorization_id duplicates a fixture name defined in tests/e2e/conftest.py and
causes shadowing; rename this fixture to something explicit (e.g.,
catalog_authorization_id), update its return to still use
e2e_config["catalog.authorization.id"], and then update all tests in
tests/e2e/catalog/ that currently depend on authorization_id to use
catalog_authorization_id so resolution is unambiguous and self-documenting.

@albertsola albertsola force-pushed the e2e/catalog/MPT-14897-catalog-listings branch from af9b083 to 8dd1a7e Compare December 5, 2025 10:49
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 (1)
tests/e2e/catalog/listings/test_async_listings.py (1)

26-27: Consider making this test async for consistency.

This test function is synchronous while using an async fixture (async_created_listing). Although pytest-asyncio can handle this, all other test functions in this module (lines 30, 36, 40, 47) are async, making this inconsistent.

Apply this diff to make the test async:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+async def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af9b083 and 8dd1a7e.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/e2e/catalog/listings/conftest.py
  • tests/e2e/catalog/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.356Z
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.356Z
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/conftest.py
🧬 Code graph analysis (1)
tests/e2e/catalog/listings/test_async_listings.py (6)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/helper.py (3)
  • assert_async_service_filter_with_iterate (31-39)
  • assert_async_update_resource (62-68)
  • async_create_fixture_resource_and_delete (8-16)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • product_id (96-97)
tests/e2e/catalog/listings/conftest.py (1)
  • listing_data (15-34)
tests/e2e/catalog/listings/test_sync_listings.py (1)
  • test_create_listing (24-25)
tests/seed/catalog/test_product.py (1)
  • product (18-19)
🪛 Ruff (0.14.7)
tests/e2e/catalog/listings/test_sync_listings.py

24-24: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/catalog/listings/test_async_listings.py

26-26: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

⏰ 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 (16)
tests/e2e/conftest.py (1)

146-148: LGTM!

The new price_list_id fixture follows the established pattern for e2e config fixtures and correctly references the catalog price list identifier added to the configuration.

tests/e2e/catalog/listings/test_async_listings.py (7)

13-15: LGTM!

The fixture correctly provides the async listings service from the operations client.


18-23: LGTM!

The async fixture properly manages the listing lifecycle using the async context manager helper for resource creation and cleanup.


30-33: LGTM!

The async test correctly retrieves a listing by ID and verifies the result.


36-37: LGTM!

The async filter test correctly uses the helper to verify filtering functionality.


40-44: LGTM!

The async test properly validates not-found error handling with the expected 404 response.


47-50: LGTM!

The async update test correctly uses the helper to verify listing updates.


26-26: Remove unused noqa directive.

The noqa: AAA01 directive is not recognized and should be removed.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
⛔ Skipped due to learnings
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 136
File: tests/e2e/notifications/subscribers/conftest.py:14-25
Timestamp: 2025-12-01T10:48:52.586Z
Learning: The repository softwareone-platform/mpt-api-python-client uses wemake-python-styleguide linter, so noqa directives for WPS rules should not be flagged as unused.
e2e_config.test.json (1)

14-33: LGTM!

The configuration correctly introduces catalog-specific identifiers while maintaining existing commerce identifiers, providing comprehensive test data for both catalog and commerce e2e tests.

tests/e2e/catalog/listings/test_sync_listings.py (7)

13-15: LGTM!

The fixture correctly provides the synchronous listings service from the operations client.


18-21: LGTM!

The sync fixture properly manages the listing lifecycle using the sync context manager helper for resource creation and cleanup.


28-31: LGTM!

The test correctly retrieves a listing by ID and verifies the result.


34-39: LGTM!

The filter test correctly uses the helper to verify filtering functionality.


42-46: LGTM!

The test properly validates not-found error handling with the expected 404 response.


49-52: LGTM!

The update test correctly uses the helper to verify listing updates.


24-25: Remove unused noqa directive.

The noqa: AAA01 directive is not recognized and should be removed.

Apply this diff:

-def test_create_listing(created_listing, product_id):  # noqa: AAA01
+def test_create_listing(created_listing, product_id):
     assert created_listing.product.id == product_id
⛔ Skipped due to learnings
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 136
File: tests/e2e/notifications/subscribers/conftest.py:14-25
Timestamp: 2025-12-01T10:48:52.586Z
Learning: The repository softwareone-platform/mpt-api-python-client uses wemake-python-styleguide linter, so noqa directives for WPS rules should not be flagged as unused.

@albertsola albertsola force-pushed the e2e/catalog/MPT-14897-catalog-listings branch 2 times, most recently from 653327c to 931b9d5 Compare December 5, 2025 10:56
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 (2)
tests/e2e/catalog/listings/test_async_listings.py (1)

26-27: Remove unused noqa directive.

The noqa: AAA01 comment is unnecessary and should be removed for cleaner code.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
tests/e2e/catalog/listings/test_sync_listings.py (1)

24-25: Remove unused noqa directive.

The noqa: AAA01 comment is unnecessary and should be removed for cleaner code.

Apply this diff:

-def test_create_listing(created_listing, product_id):  # noqa: AAA01
+def test_create_listing(created_listing, product_id):
     assert created_listing.product.id == product_id
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8dd1a7e and 931b9d5.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/e2e/catalog/conftest.py
  • tests/e2e/conftest.py
🧰 Additional context used
🧬 Code graph analysis (2)
tests/e2e/catalog/listings/test_async_listings.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/helper.py (3)
  • assert_async_service_filter_with_iterate (31-39)
  • assert_async_update_resource (62-68)
  • async_create_fixture_resource_and_delete (8-16)
tests/e2e/conftest.py (3)
  • async_mpt_ops (36-39)
  • product_id (96-97)
  • short_uuid (101-102)
tests/seed/catalog/test_product.py (1)
  • product (15-16)
tests/e2e/catalog/listings/conftest.py (2)
tests/e2e/conftest.py (6)
  • mpt_ops (31-32)
  • e2e_config (89-92)
  • authorization_id (147-148)
  • product_id (96-97)
  • account_id (122-123)
  • seller_id (127-128)
tests/e2e/catalog/conftest.py (1)
  • authorization_id (20-21)
🪛 Ruff (0.14.7)
tests/e2e/catalog/listings/test_async_listings.py

26-26: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/catalog/listings/test_sync_listings.py

24-24: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

⏰ 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 (6)
tests/e2e/catalog/listings/test_async_listings.py (2)

13-23: LGTM! Fixtures are well-structured.

The fixtures correctly provide the async listings service and handle the create/delete lifecycle for test listings using the helper context manager.


30-54: LGTM! Async test coverage is comprehensive.

The tests correctly cover retrieval, filtering, error handling, updates, and deletion using appropriate async patterns and helper functions.

e2e_config.test.json (1)

14-33: LGTM! Configuration entries are properly structured.

The catalog and commerce identifiers are correctly added to support the new end-to-end listing tests.

tests/e2e/catalog/listings/conftest.py (1)

4-11: LGTM! Service and ID fixtures are correctly implemented.

These fixtures properly extract the listings service and listing ID from the appropriate sources.

tests/e2e/catalog/listings/test_sync_listings.py (2)

18-21: LGTM! Fixture handles lifecycle correctly.

The created_listing fixture properly manages the create/delete lifecycle using the helper context manager.


28-56: LGTM! Sync test coverage is comprehensive.

The tests correctly cover all CRUD operations, filtering, and error handling using appropriate helper functions and assertions.

Comment on lines +13 to +15
@pytest.fixture
def listings_service(mpt_ops):
return mpt_ops.catalog.listings
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove duplicate fixture definition.

The listings_service fixture is already defined in tests/e2e/catalog/listings/conftest.py (lines 4-6). This duplicate definition should be removed.

Apply this diff:

-@pytest.fixture
-def listings_service(mpt_ops):
-    return mpt_ops.catalog.listings
-
-
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@pytest.fixture
def listings_service(mpt_ops):
return mpt_ops.catalog.listings
🤖 Prompt for AI Agents
In tests/e2e/catalog/listings/test_sync_listings.py around lines 13 to 15,
remove the duplicate listings_service fixture definition (it is already defined
in tests/e2e/catalog/listings/conftest.py lines 4-6); delete these three lines
so the test uses the shared fixture from conftest.py instead of redefining it
locally.

@albertsola albertsola force-pushed the e2e/catalog/MPT-14897-catalog-listings branch from 931b9d5 to 4ef140e Compare December 5, 2025 11:03
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

♻️ Duplicate comments (1)
tests/e2e/catalog/listings/test_sync_listings.py (1)

13-15: Remove duplicate fixture definition.

The listings_service fixture is already defined in tests/e2e/catalog/listings/conftest.py. This duplicate definition should be removed to use the shared fixture.

Apply this diff:

-@pytest.fixture
-def listings_service(mpt_ops):
-    return mpt_ops.catalog.listings
-
-
🧹 Nitpick comments (2)
tests/e2e/catalog/listings/test_async_listings.py (1)

26-27: Remove unused noqa directive.

The noqa: AAA01 comment references a flake8-aaa code that is not recognized by ruff (the static analysis tool in use). Remove the unused directive.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+def test_create_listing(async_created_listing, product_id):
     assert async_created_listing.product.id == product_id
tests/e2e/catalog/listings/test_sync_listings.py (1)

24-25: Remove unused noqa directive.

The noqa: AAA01 comment references a flake8-aaa code that is not recognized by ruff (the static analysis tool in use). Remove the unused directive.

Apply this diff:

-def test_create_listing(created_listing, product_id):  # noqa: AAA01
+def test_create_listing(created_listing, product_id):
     assert created_listing.product.id == product_id
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 931b9d5 and 4ef140e.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/e2e/catalog/conftest.py
  • e2e_config.test.json
  • tests/e2e/catalog/listings/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.356Z
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.356Z
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/catalog/listings/test_sync_listings.py
🧬 Code graph analysis (3)
tests/e2e/conftest.py (1)
tests/e2e/catalog/conftest.py (1)
  • price_list_id (25-26)
tests/e2e/catalog/listings/test_sync_listings.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/helper.py (3)
  • assert_service_filter_with_iterate (42-50)
  • assert_update_resource (53-59)
  • create_fixture_resource_and_delete (20-28)
tests/e2e/catalog/listings/conftest.py (2)
  • listing_data (15-34)
  • listing_id (10-11)
tests/e2e/conftest.py (3)
  • mpt_ops (31-32)
  • product_id (96-97)
  • short_uuid (101-102)
tests/seed/catalog/test_product.py (1)
  • product (15-16)
tests/e2e/catalog/listings/test_async_listings.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/helper.py (3)
  • assert_async_service_filter_with_iterate (31-39)
  • assert_async_update_resource (62-68)
  • async_create_fixture_resource_and_delete (8-16)
tests/e2e/conftest.py (3)
  • async_mpt_ops (36-39)
  • product_id (96-97)
  • short_uuid (101-102)
tests/e2e/catalog/listings/conftest.py (1)
  • listing_data (15-34)
tests/seed/catalog/test_product.py (1)
  • product (15-16)
🪛 Ruff (0.14.7)
tests/e2e/catalog/listings/test_sync_listings.py

24-24: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/catalog/listings/test_async_listings.py

26-26: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

⏰ 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 (8)
tests/e2e/conftest.py (1)

151-153: LGTM! Fixture addition follows established pattern.

The price_list_id fixture correctly retrieves the catalog price list ID from the e2e configuration. While a fixture with the same name exists in tests/e2e/catalog/conftest.py, this parent-level fixture provides a fallback for tests outside the catalog subdirectory. Based on learnings, this duplication pattern is intentional and allows child scopes to override when needed.

tests/e2e/catalog/listings/test_async_listings.py (4)

1-10: LGTM! Imports and test markers are correct.

The imports use the correct tests.e2e.helper path, and the flaky marker appropriately handles potential transient failures in end-to-end tests.


13-15: LGTM! Fixture provides async listings service.

The fixture correctly exposes the async catalog listings service for use in async tests.


18-23: LGTM! Async fixture with proper lifecycle management.

The fixture correctly uses an async context manager to create a listing resource and ensure cleanup after the test completes.


30-54: LGTM! Comprehensive async test coverage.

The async tests properly cover the full listing lifecycle:

  • Retrieval by ID
  • Filtering with iteration
  • Error handling for not-found scenarios
  • Updates with field modifications
  • Deletion

All tests correctly use await for async operations and follow established testing patterns.

tests/e2e/catalog/listings/test_sync_listings.py (3)

1-10: LGTM! Imports and test markers are correct.

The imports use the correct tests.e2e.helper path, and the flaky marker appropriately handles potential transient failures in end-to-end tests.


18-21: LGTM! Fixture provides proper lifecycle management.

The fixture correctly uses a context manager to create a listing resource and ensure cleanup after the test completes.


28-56: LGTM! Comprehensive sync test coverage.

The sync tests properly cover the full listing lifecycle with synchronous operations:

  • Retrieval by ID
  • Filtering with iteration
  • Error handling for not-found scenarios
  • Updates with field modifications
  • Deletion

All tests follow established patterns and provide good coverage parallel to the async tests.

@albertsola albertsola force-pushed the e2e/catalog/MPT-14897-catalog-listings branch from 4ef140e to 01c1445 Compare December 5, 2025 11:13
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/catalog/listings/test_async_listings.py (1)

26-26: Remove unused noqa directive.

The noqa: AAA01 directive references an unknown error code. If this is meant for a different linter, please verify; otherwise, remove it.

Apply this diff:

-def test_create_listing(async_created_listing, product_id):  # noqa: AAA01
+def test_create_listing(async_created_listing, product_id):
tests/e2e/catalog/listings/test_sync_listings.py (1)

24-24: Remove unused noqa directive.

The noqa: AAA01 directive references an unknown error code. If this is meant for a different linter, please verify; otherwise, remove it.

Apply this diff:

-def test_create_listing(created_listing, product_id):  # noqa: AAA01
+def test_create_listing(created_listing, product_id):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ef140e and 01c1445.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/e2e/catalog/conftest.py
  • tests/e2e/catalog/listings/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.356Z
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.356Z
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/catalog/listings/test_sync_listings.py
🧬 Code graph analysis (2)
tests/e2e/conftest.py (1)
tests/e2e/catalog/conftest.py (1)
  • price_list_id (25-26)
tests/e2e/catalog/listings/test_sync_listings.py (3)
tests/e2e/helper.py (2)
  • assert_service_filter_with_iterate (42-50)
  • assert_update_resource (53-59)
tests/e2e/conftest.py (3)
  • mpt_ops (31-32)
  • product_id (96-97)
  • short_uuid (101-102)
tests/e2e/catalog/listings/conftest.py (2)
  • listing_data (10-29)
  • listing_id (5-6)
🪛 Ruff (0.14.7)
tests/e2e/catalog/listings/test_async_listings.py

26-26: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/catalog/listings/test_sync_listings.py

24-24: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

⏰ 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 (4)
tests/e2e/catalog/listings/test_async_listings.py (1)

1-54: LGTM! Comprehensive async test coverage.

The async test suite properly covers the full lifecycle of catalog listings including creation, retrieval, filtering, error handling, updates, and deletion. The use of async context managers and helper utilities follows established patterns.

e2e_config.test.json (1)

14-33: LGTM! Configuration properly supports catalog and commerce namespaces.

The addition of catalog-specific identifiers alongside existing commerce identifiers enables proper E2E test configuration for the catalog listings functionality.

tests/e2e/catalog/listings/test_sync_listings.py (1)

1-56: LGTM! Comprehensive sync test coverage.

The sync test suite provides thorough coverage of catalog listings operations, properly using synchronous patterns and helper utilities. The test structure mirrors the async implementation effectively.

tests/e2e/conftest.py (1)

151-153: No action required. The price_list_id fixture in tests/e2e/catalog/conftest.py is intentionally scoped to its directory hierarchy. Child conftest.py files in pytest commonly define their own fixtures to control scope and precedence, which is standard behavior—not a defect.

Likely an incorrect or invalid review comment.



def test_create_listing(async_created_listing, product_id): # noqa: AAA01
assert async_created_listing.product.id == product_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert async_created_listing.product.id == product_id
def test_create_listing(async_created_listing, product_id):
result = async_created_listing.product.id
assert result == product_id

Comment on lines 24 to 25
def test_create_listing(created_listing, product_id): # noqa: AAA01
assert created_listing.product.id == product_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def test_create_listing(created_listing, product_id): # noqa: AAA01
assert created_listing.product.id == product_id
def test_create_listing(created_listing, product_id):
result = created_listing.product.id
assert result == product_id

@albertsola albertsola force-pushed the e2e/catalog/MPT-14897-catalog-listings branch from 01c1445 to c9a22d6 Compare December 5, 2025 13:50
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 (1)
tests/e2e/catalog/listings/test_sync_listings.py (1)

24-58: E2E coverage for listing lifecycle is solid, with one optional refinement around delete.

  • test_create_listing, test_get_listing_by_id, test_filter_listings, and test_update_listing exercise the happy-path lifecycle well and correctly reuse shared helpers and fixtures (product_id, listing_id, short_uuid).
  • test_get_listing_not_found asserting MPTAPIError with match=r"404 Not Found" aligns with the current MPTAPIError.__str__ format and is a clear contract for 404s.

One minor optional refinement:

  • In test_delete_listing, you delete created_listing.id explicitly while created_listing’s fixture teardown will also attempt to delete the same resource via create_fixture_resource_and_delete. Because that helper swallows MPTAPIError, this is safe, but it may cause extra API traffic and noisy teardown logs if deletes are not idempotent.
  • If this becomes noisy, consider:
    • Creating a dedicated “delete-only” fixture (or inline create) that does not auto-delete in teardown for this test, or
    • Extending create_fixture_resource_and_delete to detect/skip deletion when the resource has already been deleted.

Right now it’s harmless, so this is purely an optional cleanup.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01c1445 and c9a22d6.

📒 Files selected for processing (6)
  • e2e_config.test.json (1 hunks)
  • tests/e2e/catalog/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/conftest.py (1 hunks)
  • tests/e2e/catalog/listings/test_async_listings.py (1 hunks)
  • tests/e2e/catalog/listings/test_sync_listings.py (1 hunks)
  • tests/e2e/conftest.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/e2e/catalog/conftest.py
  • tests/e2e/conftest.py
  • tests/e2e/catalog/listings/test_async_listings.py
  • tests/e2e/catalog/listings/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:36.356Z
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.356Z
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/catalog/listings/test_sync_listings.py
🧬 Code graph analysis (1)
tests/e2e/catalog/listings/test_sync_listings.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/helper.py (3)
  • assert_service_filter_with_iterate (42-50)
  • assert_update_resource (53-59)
  • create_fixture_resource_and_delete (20-28)
tests/e2e/conftest.py (3)
  • mpt_ops (31-32)
  • product_id (96-97)
  • short_uuid (101-102)
tests/e2e/catalog/listings/conftest.py (1)
  • listing_data (10-29)
⏰ 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)
e2e_config.test.json (1)

14-33: Config additions for catalog/commerce IDs look consistent with new E2E fixtures.

The new catalog.* entries (authorization, listing, price_list, product/item) and the retained commerce.* IDs match the fixtures and helper usage in the E2E tests (e.g., authorization_id, price_list_id, listing_id, product_id). The JSON remains valid and the naming is coherent, so this config change looks good.

tests/e2e/catalog/listings/test_sync_listings.py (2)

1-8: Imports and helper usage are wired correctly.

Using tests.e2e.helper for assert_service_filter_with_iterate, assert_update_resource, and create_fixture_resource_and_delete is consistent with the existing E2E helpers and resolves the earlier import-path issue; no changes needed here.


13-21: Fixture setup for listings_service and created_listing is appropriate.

Resolving mpt_ops.catalog.listings via the listings_service fixture and using create_fixture_resource_and_delete for created_listing gives clear, reusable wiring and automatic cleanup for created listings; this matches the patterns used elsewhere in the e2e suite and looks good as-is. Based on learnings, I’m intentionally not suggesting moving or deduplicating these fixtures across conftest layers in this PR.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2025

@albertsola albertsola merged commit 5acd987 into main Dec 5, 2025
6 checks passed
@albertsola albertsola deleted the e2e/catalog/MPT-14897-catalog-listings branch December 5, 2025 14:05
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