Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-34449-poa-requests-mock #20353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rockwellwindsor-va
Copy link
Contributor

@rockwellwindsor-va rockwellwindsor-va commented Jan 17, 2025

Summary

  • Adds optional param to local BGS call so we can ensure to mock only where we want to
  • Adds BGS for mocking in the betamocks service config
  • Adds new setting under the claims_api namespace for enabling mocking of these BGS calls
  • Threads optional param through from read_poa_request which is the BGS call used in the workflow for this ticket specifically

Related issue(s)

API-34449

Testing done

  • *There should be no change to current functionality

Testing Notes

  • You will need the matching PR from the mock data repo to properly test this out.
  • In the mockdata repo pull down the latest and switch to branch API-34449-mock-poa-request-responses
  • In settings local add these settings right under claims api (can be anywhere other included to show indenting):
claims_api:
...
 bgs: <--- new
   mock_responses: true <------- new
 local_bgs:
   use_mocks_for_v2: true
 v2_docs:
   enabled: true
  • Hit http://localhost:3000/services/claims/v2/veterans/power-of-attorney-requests
  • You should see the mocked response (partial screenshot below) come back (we can always change the text I added (mock) to make this easy to see)

Screenshots

Screenshot 2025-01-17 at 2 52 32 PM

What areas of the site does it impact?

  • modified: config/betamocks/services_config.yml
  • modified: config/settings.yml
  • modified: modules/claims_api/app/services/claims_api/power_of_attorney_request_service/index.rb
  • modified: modules/claims_api/lib/bgs_service/local_bgs.rb
  • modified: modules/claims_api/lib/bgs_service/manage_representative_service.rb

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@rockwellwindsor-va rockwellwindsor-va changed the title WIP API-34449-poa-requests-mock Jan 17, 2025
@rockwellwindsor-va rockwellwindsor-va added the claimsApi modules/claims_api label Jan 17, 2025
@rockwellwindsor-va rockwellwindsor-va marked this pull request as ready for review January 17, 2025 21:04
@rockwellwindsor-va rockwellwindsor-va requested review from a team as code owners January 17, 2025 21:04
Comment on lines +308 to +310
def use_mocks?(use_mocks)
use_mocks && Settings.claims_api.bgs.mock_responses
end
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just use the settings.yml value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because we can't blanket everything that uses this

@@ -30,7 +30,8 @@ def get_poa_list

def poa_list
@poa_list ||= manage_representative_service.read_poa_request(poa_codes: @poa_codes, page_size: @page_size,
page_index: @page_index, filter: @filter)
page_index: @page_index, filter: @filter,
use_mocks: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

why hardcode use_mocks per method?

Copy link
Contributor Author

@rockwellwindsor-va rockwellwindsor-va Jan 17, 2025

Choose a reason for hiding this comment

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

Since local BGS is shared this was the best option I could think of to make sure mocks only happen for the specific requests we want them too.

That being said totally open to a better approach, there is a discussion here

Copy link
Contributor

Choose a reason for hiding this comment

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

i see - we donʼt want all-or-nothing. i was initially thrown by the 'use_mocks', as if we are telling the call to use mockdata. maybe 'enable_mocks' or 'allow_mocks' could help future maintainers 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants