Skip to content

MPT-19909: add /integration/categories service#280

Merged
albertsola merged 2 commits intomainfrom
MPT-19909/integration-categories
Apr 7, 2026
Merged

MPT-19909: add /integration/categories service#280
albertsola merged 2 commits intomainfrom
MPT-19909/integration-categories

Conversation

@albertsola
Copy link
Copy Markdown
Contributor

@albertsola albertsola commented Apr 7, 2026

Summary

Implements the /public/v1/integration/categories endpoint group as part of MPT-13310.

Changes

  • mpt_api_client/resources/integration/categories.pyCategoriesService / AsyncCategoriesService (GetMixin + CollectionMixin)
  • Updated integration.py to expose categories property
  • Unit tests: tests/unit/resources/integration/test_categories.py
  • E2e tests: tests/e2e/integration/categories/

Depends on

#277 (MPT-19892 — rename extensibility → integration)

⚠️ Draft — all PRs in this group target MPT-19892/e2e-extension-base-service until PR #277 merges, then rebase onto main.

Closes MPT-19909

  • Added /public/v1/integration/categories endpoint service with synchronous CategoriesService and asynchronous AsyncCategoriesService
  • Introduced Category model with fields for name, revision, description, status, and audit
  • Exposed categories property on Integration and AsyncIntegration classes for accessing the new service
  • Added comprehensive unit tests validating service initialization, model parsing, and HTTP operations (create, iterate)
  • Added E2E test coverage for synchronous and asynchronous category operations including create, filter, and update functionality

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new Categories resource to the integration API client, including a Category model, synchronous and asynchronous service classes, and comprehensive test coverage. The implementation follows existing patterns for resource management and composition.

Changes

Cohort / File(s) Summary
Categories Service Implementation
mpt_api_client/resources/integration/categories.py
New Category model with optional fields (name, revision, description, status, audit). Introduces CategoriesServiceConfig binding to /public/v1/integration/categories endpoint. Implements CategoriesService and AsyncCategoriesService through HTTP mixin composition for CRUD operations.
Integration Service Integration
mpt_api_client/resources/integration/integration.py
Adds categories property to both Integration and AsyncIntegration classes, instantiating and returning the corresponding service types using the existing HTTP client.
Unit Tests
tests/unit/resources/integration/test_categories.py, tests/unit/resources/integration/test_integration.py
New test module validates Category model parsing, service initialization, mixin exposure, and HTTP-mocked operations (create, iterate). Extended property tests to verify categories accessor on both sync and async Integration classes.
E2E Tests
tests/e2e/integration/categories/conftest.py, tests/e2e/integration/categories/test_sync_categories.py, tests/e2e/integration/categories/test_async_categories.py
Fixture definitions for categories service instances and test data. Sync and async E2E tests exercising create, filter, update, and delete operations with lifecycle management via create_fixture_resource_and_delete(...) helpers. Delete tests marked as skipped.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed The PR title contains exactly one Jira issue key (MPT-19909) in the correct format MPT-XXXX at the beginning.
Test Coverage Required ✅ Passed PR modifies 2 code files with comprehensive test coverage including 5 test files with 138 lines of unit tests, 48 lines of fixtures, and 67 lines of E2E tests.
Single Commit Required ✅ Passed The pull request contains exactly one commit that includes all changes for implementing the /public/v1/integration/categories endpoint group.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Base automatically changed from MPT-19892/e2e-extension-base-service to main April 7, 2026 12:00
@albertsola albertsola force-pushed the MPT-19909/integration-categories branch from aa4f931 to 23a4e1d Compare April 7, 2026 12:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@albertsola albertsola force-pushed the MPT-19909/integration-categories branch from 23a4e1d to f50f523 Compare April 7, 2026 17:37
@albertsola albertsola marked this pull request as ready for review April 7, 2026 17:37
@albertsola albertsola requested a review from a team as a code owner April 7, 2026 17:37
@albertsola albertsola marked this pull request as draft April 7, 2026 17:38
Copy link
Copy Markdown

@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

🤖 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/categories/conftest.py`:
- Around line 1-25: The file's formatting fails the ruff formatter; run ruff
format on this module (or apply the same formatting changes) to fix style issues
in the fixtures definitions (e.g., categories_service, async_categories_service,
category_id, category_data); ensure imports, blank lines, and indentation match
ruff's expected layout so that `ruff format` passes and the file no longer
triggers `ruff format --check` in CI.
🪄 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: 3eff1d4f-11de-473d-94b2-e356def77803

📥 Commits

Reviewing files that changed from the base of the PR and between f543c53 and f50f523.

📒 Files selected for processing (9)
  • e2e_config.test.json
  • mpt_api_client/resources/integration/categories.py
  • mpt_api_client/resources/integration/integration.py
  • tests/e2e/integration/categories/__init__.py
  • tests/e2e/integration/categories/conftest.py
  • tests/e2e/integration/categories/test_async_categories.py
  • tests/e2e/integration/categories/test_sync_categories.py
  • tests/unit/resources/integration/test_categories.py
  • tests/unit/resources/integration/test_integration.py

@albertsola albertsola force-pushed the MPT-19909/integration-categories branch from f50f523 to fbb2f24 Compare April 7, 2026 17:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@albertsola albertsola force-pushed the MPT-19909/integration-categories branch from fbb2f24 to 938fafa Compare April 7, 2026 17:51
@albertsola albertsola marked this pull request as ready for review April 7, 2026 17:51
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
tests/e2e/integration/categories/test_sync_categories.py (1)

10-13: Consider asserting directly on the fixture.

The result = created_category assignment is redundant since it doesn't transform the value.

♻️ Suggested simplification
 def test_create_category(created_category, category_data):
-    result = created_category
-
-    assert result.name == category_data["name"]
+    assert created_category.name == category_data["name"]  # noqa: AAA01

Note: The # noqa: AAA01 comment may be needed since the Act step is performed via the fixture rather than inline code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/integration/categories/test_sync_categories.py` around lines 10 -
13, Remove the redundant assignment in test_create_category: instead of
assigning result = created_category then asserting on result, assert directly on
the fixture value created_category (e.g. assert created_category.name ==
category_data["name"]); update the test body accordingly and, if your linter
complains about an implicit "act" via fixture, add a "# noqa: AAA01" comment to
the test function to silence that specific lint warning.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/e2e/integration/categories/test_sync_categories.py`:
- Around line 10-13: Remove the redundant assignment in test_create_category:
instead of assigning result = created_category then asserting on result, assert
directly on the fixture value created_category (e.g. assert
created_category.name == category_data["name"]); update the test body
accordingly and, if your linter complains about an implicit "act" via fixture,
add a "# noqa: AAA01" comment to the test function to silence that specific lint
warning.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 52612549-1283-4ec6-b71b-b723b14a7980

📥 Commits

Reviewing files that changed from the base of the PR and between f50f523 and 938fafa.

📒 Files selected for processing (4)
  • tests/e2e/integration/categories/__init__.py
  • tests/e2e/integration/categories/conftest.py
  • tests/e2e/integration/categories/test_async_categories.py
  • tests/e2e/integration/categories/test_sync_categories.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/e2e/integration/categories/test_async_categories.py
  • tests/e2e/integration/categories/conftest.py

@albertsola albertsola merged commit db85f48 into main Apr 7, 2026
4 checks passed
@albertsola albertsola deleted the MPT-19909/integration-categories branch April 7, 2026 17:57
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