Skip to content

Conversation

@joshua-lamptey
Copy link
Contributor

This ticket introduces a new testData json object which will allow users of the external test stub to create and amend orgs with set Account Activity scenarios that will return static responses based on the field provided.

Key Changes:

  • Introduce new testData json object in TestOrganisation
  • Add relevant unit tests
  • Add new Error that inherits from StubError which will throw when AA endpoint is hit when testData is missing
  • Add new fixtures for scenarios
  • Refactor existing unit tests with new testData field

@platops-pr-bot
Copy link

@JamesMMiller
Copy link
Contributor

Could you update the readme given these changes please? We need to keep on top of that on the run up to the live services handover

Copy link

@dc-smith dc-smith left a comment

Choose a reason for hiding this comment

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

Sorry for the barrage of comments. Most of these are questions to check if I've understood things properly, but there are a few bits I think we should tweak.

Future.failed(TestDataNotFound(pillar2Id))
case e: DateTimeParseException =>
logger.error(s"Invalid date format: ${e.getMessage}")
Future.failed(RequestCouldNotBeProcessed)

Choose a reason for hiding this comment

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

It's hard to tell from the EPID, but I don't think this should be a RequestCouldNotBeProcessed. That will result in a 422, when I'd (perhaps naively) expect a malformed date to result in a 400.

Is there any previous on ETMP's behaviour on this kind of thing? I see there's no existing error mapping to 400 beyond an empty request body or JSON, so this might be correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how we also handle it in the obligationsandsubmissions controller so I got that behaviour from there

Copy link

@dc-smith dc-smith Dec 17, 2025

Choose a reason for hiding this comment

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

Right, if that endpoint cleared QA for matching with the real thing that's fine by me, thanks.

Choose a reason for hiding this comment

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

I genuinely don't know which one is correct, but hmrc/pillar2-stubs#103 has a bad date format as a 400 🤷

Choose a reason for hiding this comment

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

@joshua-lamptey please see hmrc/pillar2-stubs#103 (comment). We should probably have this return a 400 to match the static stub (and hopefully the real thing).

dc-smith
dc-smith previously approved these changes Dec 18, 2025
Copy link

@dc-smith dc-smith left a comment

Choose a reason for hiding this comment

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

LGTM

@dc-smith
Copy link

(Though return the correct response for all defined scenarios is failing)

- `fromDate`: Start date (YYYY-MM-DD)
- `toDate`: End date (YYYY-MM-DD)

### 8. Account Activity
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, I know i'm harping on about the readme but could we add the different scenarios here, and a description on how to set them

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.

5 participants