DCB Testing Script Convention
In order to be able to ease testing for DCB stories, our convention is to provide a test script that will allow POs to exercise API endpoints easily.
However, we do NOT want to embed credentials and secrets in test scripts. The convention we have adopted therefore is to set up a .dcb file in a user home directory which can be run to inject environment variables into test scripts. The environment variables which need to be set in this file are
#!/bin/bash
export KEYCLOAK_BASE="https://***/realms/dcb-hub"
export KEYCLOAK_CERT_URL="$KEYCLOAK_BASE/protocol/openid-connect/certs"
export DCB_BASE_URL="https://***/***"
export KEYCLOAK_CLIENT="dcb"
export KEYCLOAK_SECRET="***"
export DCB_ADMIN_USER=***
export DCB_ADMIN_PASS=***
export DCB_STD_USER=**
export DCB_STD_PASS=*
This is used in test scripts in the following way:
#!/bin/bash
TOKEN=`./login`
curl -X GET $DCB_BASE_URL/agencies -H "Accept-Language: en" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"
The login script will execute ~/.dcb.sh to get input values for login.
Operated as a Community Resource by the Open Library Foundation