Skip to content

MPT-22199 use camelCase documentType key in product document fixtures#346

Merged
jentyk merged 1 commit into
mainfrom
bugfix/MPT-22199/e2e-product-document-fixtures-use-wrong-cased-documenttype-key
Jun 12, 2026
Merged

MPT-22199 use camelCase documentType key in product document fixtures#346
jentyk merged 1 commit into
mainfrom
bugfix/MPT-22199/e2e-product-document-fixtures-use-wrong-cased-documenttype-key

Conversation

@jentyk

@jentyk jentyk commented Jun 12, 2026

Copy link
Copy Markdown
Member

🤖 AI-generated PR — Please review carefully.

What

Fix a wrong-cased dictionary key in the product-document e2e fixtures.

The sync and async product-document fixtures set document_data["documenttype"] = "File" using an all-lowercase key. The MPT API expects the camelCase field documentType, which the rest of the suite already uses (e.g. tests/e2e/integration/extension_documents/conftest.py, tests/e2e/program/program/document/conftest.py). With the wrong-cased key the documentType value was never sent, so the created_document_from_file / created_document_from_file_async fixtures created documents without a type and the product-document e2e tests failed.

Changed files

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py

Testing

  • make check (Docker): ruff format --check, ruff check, flake8, mypy, uv lock --check — all pass on the project tree.
  • make test (Docker): 2285 unit tests passed.
  • The product-document e2e tests themselves require live MPT API credentials and were not run locally; they run in CI.

Closes MPT-22199

Closes MPT-22199

  • Fixed casing of documentType key in product-document e2e fixtures (test_sync_document.py and test_async_document.py)
  • Changed from lowercase documenttype to camelCase documentType to match the MPT API's expected field name
  • This resolves an issue where product-document e2e tests were failing because the document type was not being properly sent to the API

…s (MPT-22199)

The sync and async product-document e2e fixtures set the dictionary key
"documenttype" (all lowercase) instead of the camelCase "documentType"
expected by the MPT API. With the wrong-cased key the document type was
never sent, so the created_document_from_file(_async) fixtures created
documents without a type and the product document e2e tests failed.

Align both fixtures with the API field name and the rest of the suite,
which already uses "documentType".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jentyk jentyk requested a review from a team as a code owner June 12, 2026 20:26
@jentyk jentyk requested review from albertsola and alephsur June 12, 2026 20:26
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 35953bb4-ac84-42ae-86f1-dfee996abdc1

📥 Commits

Reviewing files that changed from the base of the PR and between b33ba9c and 503c542.

📒 Files selected for processing (2)
  • tests/e2e/catalog/product/documents/test_async_document.py
  • tests/e2e/catalog/product/documents/test_sync_document.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • softwareone-platform/mpt-extension-skills (manual)
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*

⚙️ CodeRabbit configuration file

**/*: For each subsequent commit in this PR, explicitly verify if previous review comments have been resolved

Files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md

Working protocol for any task in this repository:

  1. Identify the task type and select only the local repository files that are relevant to that task.
  2. Read only those relevant local files before making changes.
  3. If any selected local file references shared standards or shared operational guidance that are relevant to the same task, read those shared documents too before proceeding.
  4. Treat repository-local documents as repository-specific additions, restrictions, or overrides to shared guidance.
  5. If a repository-local rule conflicts with a shared rule, the local repository rule takes precedence.

Python API client for the SoftwareONE Marketplace Platform (MPT) API. Provides synchronous
(MPTClient) and asynchronous (AsyncMPTClient) clients built on httpx, with typed
resource services, mixin-based HTTP operations, and an RQL query builder.

Documentation Reading Order

When applicable, read the repository documentation in this order:

  1. README.md — repository overview, quick start, and documentation map
  2. docs/usage.md — installation, configuration, Python usage examples, and supported Docker-based commands
  3. docs/architecture.md — layered architecture, directory structure, and key abstractions
  4. docs/local-development.md — Docker-only setup and execution model
  5. docs/testing.md — repository-specific testing strategy and command mapping
  6. docs/contributing.md — repository-specific workflow and links to shared standards
  7. docs/documentation.md — repository-specific documentation rules
  8. docs/unit_tests.md — unit test structure and guidance
  9. docs/e2e_tests.md — end-to-end test setup and execution

Then inspect the code paths relevant to the task:

  • mpt_api_client/mpt_client.py — public sync and async client entry points
  • mpt_api_client/http/ — HTTP clients, services, query state, and reusable mixins
  • mpt_api_client/resources/ — domain resource groups such as catalog, commerce, billing, and integrati...

Files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
🧠 Learnings (7)
📚 Learning: 2025-12-12T15:02:20.732Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 160
File: tests/e2e/commerce/agreement/attachment/test_async_agreement_attachment.py:55-58
Timestamp: 2025-12-12T15:02:20.732Z
Learning: In pytest with pytest-asyncio, if a test function uses async fixtures but contains no await, declare the test function as def (synchronous) instead of async def. Pytest-asyncio will resolve the async fixtures automatically; this avoids linter complaints about unnecessary async functions. This pattern applies to any test file under the tests/ directory that uses such fixtures.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-04-02T09:35:03.825Z
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 269
File: tests/e2e/helpdesk/chats/links/test_sync_links.py:18-18
Timestamp: 2026-04-02T09:35:03.825Z
Learning: In this repository’s test suite, flake8-aaa/flake8-aaa codes use short two-digit suffixes (e.g., `# noqa: AAA01`), not three-digit variants like `AAA001`. If you see `# noqa: AAA01` in a test file (e.g., when the Act step is performed via a pytest fixture rather than inline code), treat it as valid and intentional—do not flag it as an invalid/no-longer-needed noqa, and do not suggest removing it even if Ruff reports `RUF102`, since `AAA` is configured under `tool.ruff.lint.external` and these noqa directives are expected to be preserved.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-01-08T08:34:05.465Z
Learnt from: albertsola
Repo: softwareone-platform/mpt-api-python-client PR: 183
File: tests/e2e/catalog/price_lists/conftest.py:29-30
Timestamp: 2026-01-08T08:34:05.465Z
Learning: In end-to-end tests (e.g., tests/e2e/...), reuse existing API resources for read-only operations and safe mutations to speed up test execution. Reserve isolated fixtures (e.g., created_price_list) for destructive tests that require per-test creation and cleanup. Ensure tests document when a fixture creates/destroys data and clearly indicate which operations are destructive, so tests stay fast and properly isolated.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-01-08T08:34:19.306Z
Learnt from: albertsola
Repo: softwareone-platform/mpt-api-python-client PR: 183
File: tests/e2e/catalog/price_lists/items/conftest.py:26-27
Timestamp: 2026-01-08T08:34:19.306Z
Learning: In tests/e2e/catalog/price_lists/items/conftest.py, the price_list_item fixture is seeded to always provide an item. Do not add StopIteration handling in this test fixture since absence of items is not expected; treat StopIteration as an upstream test setup failure rather than a recoverable condition.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-01-08T23:38:19.565Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 186
File: tests/e2e/billing/ledger/charge/test_sync_ledger_charge.py:33-39
Timestamp: 2026-01-08T23:38:19.565Z
Learning: In Python e2e tests under tests/e2e, hardcoded external IDs (e.g., INV12345) are intentional because they come from seeded test data. Ensure the test data seeds consistently include these IDs; if seeds change, update tests accordingly. Prefer using a named constant for such IDs (e.g., INV_EXTERNAL_ID) and document the dependency on seed data to avoid brittle tests.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-02-02T13:05:41.144Z
Learnt from: albertsola
Repo: softwareone-platform/mpt-api-python-client PR: 201
File: tests/unit/resources/accounts/mixins/test_activatable_mixin.py:132-139
Timestamp: 2026-02-02T13:05:41.144Z
Learning: In the mpt-api-python-client repository, tests are configured to use pytest asyncio mode auto, which auto-detects async test functions and runs them without requiring pytest.mark.asyncio. Reviewers should rely on this behavior for all Python test files under tests/, and avoid adding unnecessary asyncio markers in async tests. Ensure test files in tests/ adhere to this convention unless a specific test requires an explicit marker.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
📚 Learning: 2026-04-16T13:00:41.320Z
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 303
File: tests/e2e/helpdesk/chats/participants/conftest.py:25-31
Timestamp: 2026-04-16T13:00:41.320Z
Learning: In mpt-api-python-client, do not treat list-wrapped arguments to CreateMixin.create() / AsyncCreateMixin.create() as an error. ResourceData is intentionally typed as Resource | list[Resource] (see mpt_api_client/models/model.py), so create() should accept either a single resource dict or a list of resource dicts (e.g., create([chat_participant_data])) to perform a batch create and return a ModelCollection. Therefore, reviewers should only flag list-wrapped create() arguments when there is evidence they violate the expected API contract beyond this documented batch-create behavior.

Applied to files:

  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/documents/test_async_document.py
🔇 Additional comments (2)
tests/e2e/catalog/product/documents/test_sync_document.py (1)

11-11: LGTM!

tests/e2e/catalog/product/documents/test_async_document.py (1)

16-16: LGTM!


📝 Walkthrough

Walkthrough

Two e2e test fixtures for document creation are corrected to use the proper camelCase field name documentType instead of documenttype when setting the document type in both synchronous and asynchronous variants of the document creation from file operation.

Changes

Document type field name casing fixes

Layer / File(s) Summary
Document type field casing corrections in e2e test fixtures
tests/e2e/catalog/product/documents/test_sync_document.py, tests/e2e/catalog/product/documents/test_async_document.py
The created_document_from_file and created_document_from_file_async fixtures are updated to use the correct camelCase field name documentType instead of the incorrect lowercase documenttype when populating the document type in test document data objects.

🎯 1 (Trivial) | ⏱️ ~3 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Pr And Commit Formatting ❓ Inconclusive Local git shows a single commit with a conventional title/body and no merge commits; GitHub PR title/description couldn’t be fetched (gh requires auth). Provide the PR title + description text (or enable authenticated GitHub access) so I can validate the <JIRA-ID> <short summary> and description-change requirements.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Documentation Up To Date ✅ Passed PR change is limited to e2e fixtures (sync/async product documents) using documentType; docs contain no documentType/documenttype mentions and no docs files are changed in the PR.

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

@sonarqubecloud

Copy link
Copy Markdown

@jentyk jentyk merged commit 3bd2da9 into main Jun 12, 2026
4 checks passed
@jentyk jentyk deleted the bugfix/MPT-22199/e2e-product-document-fixtures-use-wrong-cased-documenttype-key branch June 12, 2026 20:31
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.

2 participants