Skip to main content
Skip table of contents

Betamocks Config

Introduction

Creating a service backend endpoint for http://va.gov is a common task for developers. Due to the complexity of integrating with legacy VA REST or SOAP applications we've developed a pattern for making these connections. This document offers the Betamocks configuration required to integrate vets-api, vets-website, and vets-api-mockdata.

1. VA Profile configuration to run Betamocks on Vets-API

config/betamocks/services_config.yml

CODE
# VA Profile / Vet360
- :name: "VA Profile"
  :base_uri: <%= "#{URI(Settings.vet360.url).host}:#{URI(Settings.vet360.url).port}" %>
  :endpoints:
    - :method: :get
      :path: "/demographics/demographics/v1/*/*"
      :file_path: "vet360/demographics/default"

Modify the vets360 settings: cache_enabled: true , enabled: true , and mock: true.

config/settings.yml

CODE
...
# Settings for VAProfile
vet360:
  url: "https://int.vet360.va.gov"
  contact_information:
    cache_enabled: true
    enabled: true
    timeout: 30
    mock: true

...

2. Add credential mocked data for a new user - Sign-in Service Login

The mocked data credentials are documented in the vets-api-mockdata README.

** Requires:

  • Access to username/password of test user to mock credential data for

  • Access to local Rails development

  1. IDME, DSLOGON, MHV Credentials: On localhost vets-api, in lib/sign_in/idme/configuration.rb, set body of log_credential function to true.

lib/sign_in/idme/configuration.rb

CODE
   # Set body of log_credential function to true
      def log_credential
        true
      end
  1. LOGINGOV Credential: On localhost vets-api, in lib/sign_in/logingov/configuration.rb, set body of log_credential function to true

lib/sign_in/logingov/configuration.rb

CODE
   # Set body of log_credential function to true
      def log_credential
        true
      end
  1. Turn off auto_uplevel to reduce credential compatibility issues: in config/settings.local.yml, set sign_in.auto_uplevel = false

config/settings.local.yml, not settings.yml

CODE
sign_in:
  auto_uplevel: false
...
  1. Authenticate normally using Sign in Service (http://localhost:3001/?oauth=true&next=loginModal, then authenticate with expected credential)

  2. Mocked credential will be created in credential directory of vets-api-mockdata repository

  3. At this point, credential has successfully been mocked for the given user

3. Start Rails server

$ cd ../vets-api

$ rails server

=> Booting Puma

4. Build Vets Website applications

$ cd ../vets-website

$ yarn build

yarn run v1.19.1


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.