Skip to content

MPT-20326: Added endpoints and e2e tests for program parameter groups#307

Merged
robcsegal merged 1 commit intomainfrom
MPT-20326-add-endpoints-and-e-2-e-tests-for-program-parameter-groups
Apr 17, 2026
Merged

MPT-20326: Added endpoints and e2e tests for program parameter groups#307
robcsegal merged 1 commit intomainfrom
MPT-20326-add-endpoints-and-e-2-e-tests-for-program-parameter-groups

Conversation

@robcsegal
Copy link
Copy Markdown
Contributor

@robcsegal robcsegal commented Apr 17, 2026

This pull request adds support for managing program parameter groups in the API client. It introduces new service classes for both synchronous and asynchronous operations on parameter groups, updates the main Program services to expose these new capabilities, and provides comprehensive unit and end-to-end tests to verify the new functionality.

New Program Parameter Groups Support:

  • Added ParameterGroup model and ParameterGroupsService / AsyncParameterGroupsService classes to programs_parameter_groups.py, including endpoint configuration and resource mixins.
  • Updated Program and AsyncProgramsService classes in programs.py to provide .parameter_groups(program_id) methods for accessing the new services. [1] [2] [3]

Testing Enhancements:

  • Added unit tests for the new services and model in test_programs_parameter_groups.py, covering endpoints, method presence, and model field parsing.
  • Added end-to-end tests for both sync and async parameter group operations (create, update, get, delete, filter/select) in test_sync_parameter_group.py and test_async_parameter_group.py, with supporting fixtures in conftest.py. [1] [2] [3]
  • Updated unit tests for Program services to check for the presence of the new .parameter_groups methods. [1] [2] [3]

Configuration Updates:

  • Added a seeded parameter group ID to e2e_config.test.json for use in tests.

Closes MPT-20326

  • Added ParameterGroup model with typed fields for metadata (name, label, description, display_order, default), counts (parameter_count), and relationships (program, audit)
  • Introduced ParameterGroupsService and AsyncParameterGroupsService with endpoint configuration at /public/v1/program/programs/{program_id}/parameter-groups and support for managed resource operations (create, read, update, delete, list, filter, select)
  • Extended ProgramsService and AsyncProgramsService with parameter_groups(program_id) factory methods for accessing parameter group services
  • Added comprehensive end-to-end tests for synchronous and asynchronous parameter group operations including create, update, get, delete, and filtered listing with field selection
  • Added unit tests validating service configuration, endpoint paths, public method availability, and model field parsing
  • Added pytest fixtures for parameter group e2e tests with test data and configuration

@robcsegal robcsegal requested a review from a team as a code owner April 17, 2026 12:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

The changes introduce support for parameter groups under programs by adding a new ParameterGroup model, ParameterGroupsService and AsyncParameterGroupsService classes, a parameter_groups() factory method to ProgramsService, test fixtures, and both unit and end-to-end test coverage.

Changes

Cohort / File(s) Summary
Resource Configuration and Models
e2e_config.test.json, mpt_api_client/resources/program/programs_parameter_groups.py
Added test configuration value for parameter group ID and new ParameterGroup model with optional fields (name, label, description, display_order, default, parameter_count, program, audit). Defined ParameterGroupsServiceConfig with REST endpoint template /public/v1/program/programs/{program_id}/parameter-groups.
Service Integration
mpt_api_client/resources/program/programs.py
Added parameter_groups(program_id) factory method to both ProgramsService and AsyncProgramsService, returning ParameterGroupsService and AsyncParameterGroupsService instances respectively with appropriate endpoint parameters.
E2E Test Suite
tests/e2e/program/program/parameter_group/conftest.py, tests/e2e/program/program/parameter_group/test_async_parameter_group.py, tests/e2e/program/program/parameter_group/test_sync_parameter_group.py
Added pytest fixtures for parameter group ID and test data, plus both sync and async e2e test modules covering CRUD operations (create, update, get, delete) and filtered querying with field selection.
Unit Tests
tests/unit/resources/program/test_programs.py, tests/unit/resources/program/test_programs_parameter_groups.py
Extended programs service tests with parameter_groups factory method validation; added comprehensive unit tests for ParameterGroupsService, AsyncParameterGroupsService, and ParameterGroup model covering service configuration, REST paths, available methods, and model field materialization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 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 in the required MPT-XXXX format: MPT-20326.
Test Coverage Required ✅ Passed PR modifies 2 code files in mpt_api_client and includes 5 test files across unit and e2e suites, satisfying the requirement for test file inclusion.
Single Commit Required ✅ Passed The PR contains exactly one commit (78664e1 Added endpoints and e2e tests for program parameter groups), which satisfies the requirement for a single commit.

✏️ 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.

@robcsegal robcsegal force-pushed the MPT-20326-add-endpoints-and-e-2-e-tests-for-program-parameter-groups branch from 2527119 to 78664e1 Compare April 17, 2026 12:33
@sonarqubecloud
Copy link
Copy Markdown

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

🧹 Nitpick comments (2)
tests/e2e/program/program/parameter_group/test_async_parameter_group.py (1)

43-49: Async delete test has the same weak-verification pattern as sync.

Consider validating deletion explicitly (e.g., follow-up get() failure) and avoid reusing a teardown-deleting fixture for this test to prevent expected teardown noise.

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

In `@tests/e2e/program/program/parameter_group/test_async_parameter_group.py`
around lines 43 - 49, The test_delete_parameter_group currently calls delete on
a fixture-created resource and lacks an explicit verification; modify
test_delete_parameter_group to create its own parameter group (do not use the
teardown-deleting fixture created_parameter_group), call await
async_mpt_vendor.program.programs.parameter_groups(program_id).delete(created.id),
then attempt a follow-up await
async_mpt_vendor.program.programs.parameter_groups(program_id).get(created.id)
and assert the expected failure (e.g., raise/HTTP 404 or falsey response) to
prove deletion; ensure you reference the parameter_groups(...) helper and the
delete/get methods when implementing the create->delete->verify flow.
tests/e2e/program/program/parameter_group/test_sync_parameter_group.py (1)

43-49: Strengthen the delete test assertion and avoid the guaranteed double-delete path.

test_delete_parameter_group performs delete with no verification, and teardown then tries to delete the same resource again. Consider creating a resource scoped to this test and asserting a subsequent get() fails.

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

In `@tests/e2e/program/program/parameter_group/test_sync_parameter_group.py`
around lines 43 - 49, test_delete_parameter_group currently deletes a shared
fixture resource without verifying deletion and causes teardown to
double-delete; update the test to create a parameter group scoped to this test
(call programs.parameter_groups(program_id).create(...) or otherwise create a
fresh resource instead of using created_parameter_group), call
result.delete(new_parameter_group.id), then assert deletion by calling
result.get(new_parameter_group.id) and expecting a failure (e.g., raise HTTP 404
or None) to confirm removal; this avoids using the shared
created_parameter_group fixture and prevents the guaranteed double-delete path.
🤖 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/program/program/parameter_group/test_sync_parameter_group.py`:
- Line 17: Ruff is reporting RUF102 for the intentional "noqa: WPS421"
suppression on the print line "TEARDOWN - Unable to delete parameter group …",
so update the Ruff configuration to recognize wemake-style external rule codes
(WPS) so Ruff respects the WPS421 noqa; specifically, add WPS to the
external-rule/external codes in your Ruff config (pyproject.toml/.ruff.toml) or
otherwise map/allow WPS codes so the "noqa: WPS421" on that teardown print
statement is honored and RUF102 is no longer emitted.

---

Nitpick comments:
In `@tests/e2e/program/program/parameter_group/test_async_parameter_group.py`:
- Around line 43-49: The test_delete_parameter_group currently calls delete on a
fixture-created resource and lacks an explicit verification; modify
test_delete_parameter_group to create its own parameter group (do not use the
teardown-deleting fixture created_parameter_group), call await
async_mpt_vendor.program.programs.parameter_groups(program_id).delete(created.id),
then attempt a follow-up await
async_mpt_vendor.program.programs.parameter_groups(program_id).get(created.id)
and assert the expected failure (e.g., raise/HTTP 404 or falsey response) to
prove deletion; ensure you reference the parameter_groups(...) helper and the
delete/get methods when implementing the create->delete->verify flow.

In `@tests/e2e/program/program/parameter_group/test_sync_parameter_group.py`:
- Around line 43-49: test_delete_parameter_group currently deletes a shared
fixture resource without verifying deletion and causes teardown to
double-delete; update the test to create a parameter group scoped to this test
(call programs.parameter_groups(program_id).create(...) or otherwise create a
fresh resource instead of using created_parameter_group), call
result.delete(new_parameter_group.id), then assert deletion by calling
result.get(new_parameter_group.id) and expecting a failure (e.g., raise HTTP 404
or None) to confirm removal; this avoids using the shared
created_parameter_group fixture and prevents the guaranteed double-delete path.
🪄 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: d48b2f25-fe2a-4cd5-98f1-f83b3359e612

📥 Commits

Reviewing files that changed from the base of the PR and between 7c4e679 and 78664e1.

📒 Files selected for processing (8)
  • e2e_config.test.json
  • mpt_api_client/resources/program/programs.py
  • mpt_api_client/resources/program/programs_parameter_groups.py
  • tests/e2e/program/program/parameter_group/conftest.py
  • tests/e2e/program/program/parameter_group/test_async_parameter_group.py
  • tests/e2e/program/program/parameter_group/test_sync_parameter_group.py
  • tests/unit/resources/program/test_programs.py
  • tests/unit/resources/program/test_programs_parameter_groups.py

Copy link
Copy Markdown
Member

@jentyk jentyk left a comment

Choose a reason for hiding this comment

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

LGTM

@robcsegal robcsegal merged commit acd48db into main Apr 17, 2026
4 checks passed
@robcsegal robcsegal deleted the MPT-20326-add-endpoints-and-e-2-e-tests-for-program-parameter-groups branch April 17, 2026 13:36
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