Skip to content

MPT-20329: Added endpoints and e2e tests for program terms#312

Merged
robcsegal merged 1 commit intomainfrom
MPT-20329-add-endpoints-and-e-2-e-tests-for-program-terms-and-conditions
Apr 20, 2026
Merged

MPT-20329: Added endpoints and e2e tests for program terms#312
robcsegal merged 1 commit intomainfrom
MPT-20329-add-endpoints-and-e-2-e-tests-for-program-terms-and-conditions

Conversation

@robcsegal
Copy link
Copy Markdown
Contributor

@robcsegal robcsegal commented Apr 20, 2026

This pull request introduces a new "Program Terms" resource to the API client, providing both synchronous and asynchronous services for managing program terms. It includes the implementation of the resource, integration into the main program services, end-to-end and unit tests, and updates to configuration and linting settings.

The most important changes are:

Program Terms Resource Implementation:

  • Added Term, TermService, and AsyncTermService classes in mpt_api_client/resources/program/programs_terms.py to support CRUD, publish, and unpublish operations for program terms, including model definition and service configuration.

Integration with Program Services:

  • Updated mpt_api_client/resources/program/programs.py to import and expose the new terms and async terms service methods, making program terms accessible via the main program client. [1] [2] [3]
  • Updated references in tests/unit/resources/program/test_programs.py to include tests for the new terms services. [1] [2] [3]

Testing:

  • Added comprehensive end-to-end tests for both async and sync program terms operations in tests/e2e/program/program/term/test_async_term.py and test_sync_term.py, including create, update, get, delete, filter, publish, and unpublish scenarios. [1] [2]
  • Added unit tests for the new resource in tests/unit/resources/program/test_programs_terms.py, covering endpoints, method presence, field mapping, and optional fields.
  • Added fixtures and configuration for term-related e2e tests in tests/e2e/program/program/term/conftest.py.

Configuration and Linting:

  • Updated e2e_config.test.json to include a term ID for use in tests.
  • Updated pyproject.toml to add linting ignores for the new test files.

Closes MPT-20329

  • Added new Term model with fields for term metadata (name, description, display order, status) and references (program, audit)
  • Implemented TermService and AsyncTermService classes supporting CRUD operations, publish/unpublish, filtering, and iteration
  • Exposed term services through ProgramsService and AsyncProgramsService via new terms(program_id) methods
  • Added comprehensive end-to-end tests for both synchronous and asynchronous term operations, including create, update, get, delete, filter, publish, and unpublish scenarios
  • Added unit tests validating endpoints, method presence, field mapping, and optional field handling
  • Updated e2e configuration with program term ID (PTC-9643-3741-0001)
  • Added linting configuration ignores for new test files in pyproject.toml

@robcsegal robcsegal requested a review from a team as a code owner April 20, 2026 13:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

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: a43cf5b8-8a17-4fd0-9f1d-6c3dd7781924

📥 Commits

Reviewing files that changed from the base of the PR and between 10c2ca2 and e18fe84.

📒 Files selected for processing (9)
  • e2e_config.test.json
  • mpt_api_client/resources/program/programs.py
  • mpt_api_client/resources/program/programs_terms.py
  • pyproject.toml
  • tests/e2e/program/program/term/conftest.py
  • tests/e2e/program/program/term/test_async_term.py
  • tests/e2e/program/program/term/test_sync_term.py
  • tests/unit/resources/program/test_programs.py
  • tests/unit/resources/program/test_programs_terms.py

📝 Walkthrough

Walkthrough

Added support for "program terms" resource in the MPT API client, including a new Term model and TermService/AsyncTermService classes wired through ProgramsService.terms() and AsyncProgramsService.terms() methods, with corresponding unit and end-to-end test coverage.

Changes

Cohort / File(s) Summary
Test Configuration
e2e_config.test.json, pyproject.toml
Added test configuration entry for program.terms.id and added flake8 linter ignores for term test files.
Service Implementation
mpt_api_client/resources/program/programs.py, mpt_api_client/resources/program/programs_terms.py
Introduced new Term model with metadata and reference fields, TermServiceConfig with endpoint template /public/v1/program/programs/{program_id}/terms, and TermService/AsyncTermService classes. Added terms(program_id) methods to ProgramsService and AsyncProgramsService to instantiate term services.
Unit Tests
tests/unit/resources/program/test_programs.py, tests/unit/resources/program/test_programs_terms.py
Extended ProgramsService tests to verify terms() property returns correct service instances; added new test module validating TermService and AsyncTermService endpoint paths, CRUD methods, and Term model serialization/deserialization.
E2E Test Infrastructure
tests/e2e/program/program/term/conftest.py
Added pytest fixtures: term_id (from config), invalid_term_id (hardcoded invalid value), and term_data (dict with name, description, displayOrder).
E2E Test Cases
tests/e2e/program/program/term/test_sync_term.py, tests/e2e/program/program/term/test_async_term.py
Added synchronous and asynchronous E2E test modules covering term creation, retrieval, update, deletion, filtering with selection, and publish/unpublish workflows. Both include created_term fixture with teardown cleanup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #302: Established the foundational program service layer and patterns that this PR extends by adding the Term resource and service methods to ProgramsService.
  • PR #308: Adds analogous program sub-resource services with the same factory method pattern on ProgramsService/AsyncProgramsService, applying consistent architecture across multiple program resources.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed PR title contains exactly one Jira issue key (MPT-20329) in the correct MPT-XXXX format at the beginning.
Test Coverage Required ✅ Passed PR modifies 2 code files and includes 5 test files with comprehensive unit and end-to-end test coverage.
Single Commit Required ✅ Passed The PR contains exactly one commit (e18fe84 Added endpoints and e2e tests for program terms), satisfying the single commit requirement.

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

@sonarqubecloud
Copy link
Copy Markdown

@robcsegal robcsegal merged commit f83797a into main Apr 20, 2026
4 checks passed
@robcsegal robcsegal deleted the MPT-20329-add-endpoints-and-e-2-e-tests-for-program-terms-and-conditions branch April 20, 2026 13:23
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