Skip to content

Testing using Swagger UI

Erik Nelsestuen edited this page May 20, 2024 · 12 revisions

VRO's Swagger UI is available for testing VRO's API endpoints

Local testing

  1. Run VRO: ./gradlew :dockerComposeUp :app:dockerComposeUp -- see Docker Compose and Development process for details and alternatives
  2. Open a browser to http://localhost:8110/swagger or http://localhost:8111/swagger

Testing MVP endpoints:

  1. Verify VRO is running by testing an endpoint (without authenticating) by expanding an endpoint (e.g., /v1/health-data-assessment) and clicking the "Try it out" button, then "Execute". The response should be code 403 with "error": "Forbidden".
  2. Authenticate by clicking the "Authorize" button (near the top of the page), fill in the X-API-Key (at the bottom of the popup window) with one of these values (original PR), then click the "Authorize" button (NOTE: use just test-key-01 or test-key-02 in the Authorize dialog). A "Logout" button should appear. Click "Close".
  3. Retry the endpoint (now with the X-API-Key header).

Testing iMVP endpoints:

  1. Verify VRO is running by testing an endpoint (without authenticating) by expanding an endpoint (e.g., /v2/automatedClaim) and clicking the "Try it out" button, then "Execute". The response should be code 401.
  2. Authenticate by clicking the "Authorize" button (near the top of the page), fill in the "Bearer Authentication (http, Bearer)" (at the bottom of the popup window) with a valid JWT token, then click the "Authorize" button. A "Logout" button should appear. Click "Close". Use an example JWT, or use python to create a mock JWT:
    1. Install PyJWT
    python3 -m pip install PyJWT
    
    1. Checkout generate-mock-jwt.py
    2. Run the script
    python3 jwt-maker.py
    
  3. Retry the endpoint (now with the "Bearer Authentication (http, Bearer)" header)

To connect to Lighthouse, a service-data-access/src/main/resources/private.pem file is needed. If it doesn't exist, create it using this.

Testing on Non-prod LHDI deployment

Swagger UI can be accessed on the VA network at https://dev.lighthouse.va.gov/abd-vro/swagger.

Clone this wiki locally