MPT-19908: add /integration/installations service#281
MPT-19908: add /integration/installations service#281albertsola wants to merge 2 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughThis PR adds end-to-end support for integration installations to the MPT API Python client. It introduces a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
0ea416d to
1c86e4e
Compare
|
1c86e4e to
7d07055
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7d07055 to
f58b8f7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/unit/resources/integration/mixins/test_installation_mixin.py (1)
46-66: Consider adding one case that verifies JSON payload forwarding.These tests currently validate action routing and response parsing, but not that
resource_datais sent through topost(..., json=...). Adding one payload case (sync + async) would close that gap.Also applies to: 72-91
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/resources/integration/mixins/test_installation_mixin.py` around lines 46 - 66, Add a test variant that checks the request JSON payload is forwarded: in the test_post_actions function (and the async counterpart if present), include a resource_data dict and call getattr(installation_service, action)(installation_id, resource_data=resource_data) (or await for async), then assert the mocked respx.post received json==resource_data (e.g., inspect mock_route.calls[0].request.read() or .json()) and keep existing assertions on method, call_count, and response parsing to ensure post(..., json=...) is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/e2e/integration/extensions/test_async_extensions.py`:
- Around line 9-11: The test file has three consecutive blank lines before the
top-level test function test_create_extension causing ruff format --check to
fail; edit the file to remove one blank line so there are exactly two blank
lines separating top-level definitions (ensure there are two blank lines
immediately before def test_create_extension and no leftover `@pytest.mark.skip`
or stray blank lines).
---
Nitpick comments:
In `@tests/unit/resources/integration/mixins/test_installation_mixin.py`:
- Around line 46-66: Add a test variant that checks the request JSON payload is
forwarded: in the test_post_actions function (and the async counterpart if
present), include a resource_data dict and call getattr(installation_service,
action)(installation_id, resource_data=resource_data) (or await for async), then
assert the mocked respx.post received json==resource_data (e.g., inspect
mock_route.calls[0].request.read() or .json()) and keep existing assertions on
method, call_count, and response parsing to ensure post(..., json=...) is used.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 7638d5c8-b871-4f3d-b269-3aec3a657875
📒 Files selected for processing (16)
e2e_config.test.jsonmpt_api_client/resources/integration/installations.pympt_api_client/resources/integration/integration.pympt_api_client/resources/integration/mixins/__init__.pympt_api_client/resources/integration/mixins/installation_mixin.pypyproject.tomltests/e2e/integration/extensions/conftest.pytests/e2e/integration/extensions/test_async_extensions.pytests/e2e/integration/extensions/test_sync_extensions.pytests/e2e/integration/installations/__init__.pytests/e2e/integration/installations/conftest.pytests/e2e/integration/installations/test_async_installations.pytests/e2e/integration/installations/test_sync_installations.pytests/unit/resources/integration/mixins/test_installation_mixin.pytests/unit/resources/integration/test_installations.pytests/unit/resources/integration/test_integration.py
💤 Files with no reviewable changes (1)
- tests/e2e/integration/extensions/test_sync_extensions.py
|
|
||
| @pytest.mark.skip(reason="unable to create extensions for testing") | ||
|
|
||
| def test_create_extension(async_created_extension, extension_data): |
There was a problem hiding this comment.
Fix formatting to resolve pipeline failure.
The pipeline reports ruff format --check failed. Removing the @pytest.mark.skip decorator left an extra blank line, resulting in 3 consecutive blank lines before test_create_extension. Ruff format expects exactly 2 blank lines between top-level definitions.
🛠️ Proposed fix
pytestmark = [pytest.mark.flaky]
-
def test_create_extension(async_created_extension, extension_data):🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/e2e/integration/extensions/test_async_extensions.py` around lines 9 -
11, The test file has three consecutive blank lines before the top-level test
function test_create_extension causing ruff format --check to fail; edit the
file to remove one blank line so there are exactly two blank lines separating
top-level definitions (ensure there are two blank lines immediately before def
test_create_extension and no leftover `@pytest.mark.skip` or stray blank lines).



Summary
Implements the
/public/v1/integration/installationsendpoint group as part of MPT-13310.Changes
mpt_api_client/resources/integration/installations.py—InstallationsService/AsyncInstallationsServicempt_api_client/resources/integration/mixins/installation_mixin.py— lifecycle actions: invite, install, uninstall, expireintegration.pyto exposeinstallationspropertytests/unit/resources/integration/test_installations.py+test_installation_mixin.pytests/e2e/integration/installations/Depends on
#277 (MPT-19892 — rename extensibility → integration)
Closes MPT-19908
InstallationsServiceandAsyncInstallationsServiceto expose/public/v1/integration/installationsendpointInstallationmodel with fields for account, extension, lifecycle status, configuration, invitation, modules, terms, and audit metadataInstallationMixinandAsyncInstallationMixinwith lifecycle action methods:invite,install,uninstall, andexpireinstallationsproperty onIntegrationandAsyncIntegrationclassesEXT-6587-4477) and installation ID (EXI-0022-3978-5547)mpt_vendorinstead ofmpt_ops