Skip to content

Add API integration test coverage for all TRN request endpoint versions#3250

Merged
gunndabad merged 2 commits intomainfrom
trn-request-integration-tests
Apr 1, 2026
Merged

Add API integration test coverage for all TRN request endpoint versions#3250
gunndabad merged 2 commits intomainfrom
trn-request-integration-tests

Conversation

@gunndabad
Copy link
Copy Markdown
Member

@gunndabad gunndabad commented Apr 1, 2026

Context

Integration tests for the CreateTrnRequest and GetTrnRequest API operations were missing for versions 20240307 and 20240606. The test files existed but were entirely commented out, as they referenced the old CRM-based implementation (XrmFakedContext, CrmQueryDispatcherSpy, .WithTrn(), .WithEmail(), etc.) which is no longer used.

Changes proposed in this pull request

  • Uncommented and rewrote integration tests for CreateTrnRequest and GetTrnRequest for API versions 20240307, 20240606, 20250203, and 20250425, replacing obsolete CRM-based test code with the current Postgres/EF Core-based approach.

Version-specific behaviour covered:

  • 20240307: Request uses a single Email field; response includes a person object (firstName, middleName, lastName, email, dateOfBirth, nationalInsuranceNumber) — no potentialDuplicate or accessYourTeachingQualificationsLink.
  • 20240606: Request uses an EmailAddresses list; response is {requestId, status, trn} only — no person object, potentialDuplicate, or accessYourTeachingQualificationsLink.
  • 20250203: Request uses an EmailAddresses list; response is {requestId, status, trn}.
  • 20250425: Request uses an EmailAddresses list; response includes {requestId, status, trn, potentialDuplicate, accessYourTeachingQualificationsLink}.

Each version's tests cover: permission checks, request validation (invalid ID, ID length, date of birth, NINO), conflict detection, and happy-path completed/pending responses.

Guidance to review

Tests follow the same patterns as the existing V20250203 and V20250425 tests. Each version's TestBase sets the X-Api-Version header so requests are routed to the correct controller.

Checklist

  • Attach to Trello card
  • Rebased master
  • Cleaned commit history
  • Tested by running locally

@gunndabad gunndabad force-pushed the trn-request-integration-tests branch from 417995f to 0d67960 Compare April 1, 2026 14:20
@gunndabad
Copy link
Copy Markdown
Member Author

@copilot ensure there is integration test coverage for the CreateTrnRequest and GetTrnRequest API operations for versions 20240307 and 20240606. Use the tests in this PR as a base.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

@copilot ensure there is integration test coverage for the CreateTrnRequest and GetTrnRequest API operations for versions 20240307 and 20240606. Use the tests in this PR as a base.

Done in commit 3de4f56. Uncommented and updated the integration tests for CreateTrnRequest and GetTrnRequest for both 20240307 and 20240606, replacing the old CRM-based test code with the new Postgres/EF Core approach matching the V20250203 and V20250425 patterns.

Key differences handled per version:

  • 20240307: Request uses single Email field; response includes person object with firstName, middleName, lastName, email, dateOfBirth, nationalInsuranceNumber — no potentialDuplicate or accessYourTeachingQualificationsLink
  • 20240606: Request uses EmailAddresses list; response is just {requestId, status, trn} — no person object, potentialDuplicate, or accessYourTeachingQualificationsLink

@gunndabad gunndabad marked this pull request as ready for review April 1, 2026 14:43
@gunndabad gunndabad enabled auto-merge April 1, 2026 14:46
@gunndabad gunndabad added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit ccca90d Apr 1, 2026
8 checks passed
@gunndabad gunndabad deleted the trn-request-integration-tests branch April 1, 2026 16:00
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.

3 participants