Universal Credit Liability API tests.
Start Mongo Docker container as follows:
docker run --rm -d -p 27017:27017 --name mongo percona/percona-server-mongodb:6.0Start UNIVERSAL_CREDIT_LIABILITY_ALL services as follows:
sm2 --start UNIVERSAL_CREDIT_LIABILITY_ALLRun tests as follows:
- Argument
<environment>must belocal,dev,qaorstaging.
./run-tests.sh <environment>Check all project files are formatted as expected as follows:
sbt scalafmtCheckAll scalafmtCheckFormat *.sbt and project/*.scala files as follows:
sbt scalafmtSbtFormat all project files as follows:
sbt scalafmtAllBruno collection is set up for conducting manual tests and can be found under bruno.
It has been developed and tested for Bruno v2.1.0.
To use, in Bruno just select open collection, navigate to the bruno folder and open.
There are two configured environment profiles, Local and QA. There are also two auth requests, corresponding to the two environment profiles.
For more info on environment variables in Bruno see https://docs.usebruno.com/get-started/variables/environment-variables
Before you can make requests to the Universal Credit Liability Notification API, a valid auth token is required. This is obtained by triggering the auth requests corresponding to the environment profile selected (it will fail otherwise).
After a successful authentication request, the obtained auth token will be stored as a secret environment variable and utilised by the Universal Credit Liability Notification API requests. The auth token may be valid for a different length of time depending on the environment. e.g. QA = 4 hours
For Auth/QA, a privileged application subscribing to the API needs to have already been preconfigured.
The Bruno collection also has a dependency on an external JavaScript library totp-generator which will require nodejs.
After installing node, execute:
cd bruno
npm i
And then enable Developer Mode in Bruno.
For more info on external libraries in Bruno see https://docs.usebruno.com/testing/script/external-libraries
The QA environment is only semi configured, all the fields related to oauth 2.0 are specified as secrets which are not commited to the repo and will need to be manually set.
This is done because these secrets can all expire and change.
| Required QA Environment variables | Description |
|---|---|
| clientId | The client id to the QA application |
| clientSecret | any valid client secret generated by the QA application |
| TOTP_SECRET | The TOTP Secret for the given QA application |
The other secret variables are placeholders for temporary variables as part of the authentication process, they do not need to be configured. These are pre-specified so they also don't get commited to the repo.
For more info on Bruno's secret variables see https://docs.usebruno.com/secrets-management/secret-variables
This code is open source software licensed under the Apache 2.0 License.