Skip to content

Commit

Permalink
Merge pull request #96 from DEFRA/fix/set-LOG_LEVEL+test-scripts
Browse files Browse the repository at this point in the history
Fix/set log level+test scripts
  • Loading branch information
jack-mccabe-defra authored Oct 29, 2024
2 parents 53c54dc + 2884c19 commit 624b700
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 3 deletions.
2 changes: 2 additions & 0 deletions appConfig/appConfig.dev1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
value: "dev1"
- key: HEALTH_CHECK_ENABLED
value: "false"
- key: LOG_LEVEL
value: "http"

# Secrets
- key: API_TENANT_ID
Expand Down
2 changes: 2 additions & 0 deletions appConfig/appConfig.prd1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
value: "prd1"
- key: HEALTH_CHECK_ENABLED
value: "true"
- key: LOG_LEVEL
value: "http"

# Secrets
- key: API_TENANT_ID
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fcp-data-access-layer-api",
"version": "1.3.24",
"version": "1.3.26",
"description": "Customer Registry GraphQL Service",
"homepage": "https://github.com/DEFRA/fcp-data-access-layer-api",
"main": "app/index.js",
Expand Down
40 changes: 40 additions & 0 deletions test_scripts/apim-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generate token
token_request=$(curl --location "https://login.microsoftonline.com/${apim_tenant_id}/oauth2/v2.0/token" \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode "scope=${apim_scope}" \
-u "${apim_client_id}:${apim_client_secret}")

token=$(jq -r '.access_token' <<< "${token_request}")
echo "Token: ${token}"


curl --location "https://${apim_url}/person/search" \
--header "email: ${user_email}" \
--header 'Content-Type: application/json' \
--data '{
"offset": 0,
"limit": 20,
"searchFieldType": "CUSTOMER_REFERENCE",
"primarySearchPhrase": "1103020285",
"secondarySearchPhrase": null
}' \
--header "Authorization: Bearer ${token}" \
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"

curl --location "https://${apim_url}/organisation/search" \
--header "email: ${user_email}" \
--header 'Content-Type: application/json' \
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \
--header "Authorization: Bearer ${token}" \
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"

curl --location "https://${apim_url}/authorisation/organisation/${org_id}" \
--header "email: ${user_email}" \
--header "Authorization: Bearer ${token}" \
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"

curl --location "https://${apim_url}/organisation/person/${person_id}/summary?search=" \
--header "email: ${user_email}" \
--header "Authorization: Bearer ${token}" \
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"
44 changes: 44 additions & 0 deletions test_scripts/dal-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generate token
token_request=$(curl --location "https://login.microsoftonline.com/${dal_tenant_id}/oauth2/v2.0/token" \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode "scope=${dal_scope}" \
-u "${dal_client_id}:${dal_client_secret}")

token=$(jq -r '.access_token' <<< "${token_request}")
echo "Token: ${token}"


# Authenticate questions
curl --location "${dal_url}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${token}" \
--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n crn\n authenticationQuestions(entraIdUserObjectId: \"e99e8cec-6b83-4de8-b9d1-cccfeeb82dbc\") {\n isFound\n updatedAt\n memorableDate\n memorableEvent\n memorablePlace\n }\n }\n}","variables":{"crn":"1103020285"}}'

# Customer businesses
curl --location "${dal_url}" \
--header "Email: ${user_email}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${token}" \
--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n personId\n crn\n businesses {\n sbi\n name\n }\n }\n}","variables":{"crn":"1103020285"}}'

# Customer permissions
curl --location "${dal_url}" \
--header "Email: ${user_email}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${token}" \
--data '{"query":"query Customer ($crn: ID!, $sbi: ID!) {\n customer(crn: $crn) {\n crn\n business(sbi: $sbi) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"crn":"1103020285","sbi":"106833558"}}'

# Business customers
curl --location 'https://fcp-data-access-layer-api.tst1.adp.defra.gov.uk/graphql' \
--header "Email: ${user_email}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${token}" \
--data '{"query":"query BusinessCustomers ($sbi: ID!) {\n business(sbi: $sbi) {\n customers {\n firstName\n lastName\n crn\n }\n }\n}","variables":{"sbi":"107591843"}}'

# Business customer permissions
curl --location "${dal_url}" \
--header "Email: ${user_email}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${token}" \
--data '{"query":"query BusinessCustomer ($sbi: ID!, $crn: ID!) {\n business(sbi: $sbi) {\n customer(crn: $crn) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"sbi":"107591843","crn":"1100071369"}}'
25 changes: 25 additions & 0 deletions test_scripts/kits-gateway-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
curl --location "https://${gateway_url}:8444/extapi/person/search" \
--header "email: ${user_email}" \
--header 'Content-Type: application/json' \
--data '{
"offset": 0,
"limit": 20,
"searchFieldType": "CUSTOMER_REFERENCE",
"primarySearchPhrase": "1103020285",
"secondarySearchPhrase": null
}' \
--cert ${cert_location} --key ${key_location}

curl --location "https://${gateway_url}:8444/extapi/organisation/search" \
--header "email: ${user_email}" \
--header 'Content-Type: application/json' \
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \
--cert ${cert_location} --key ${key_location}

curl --location "https://${gateway_url}:8444/extapi/authorisation/organisation/${org_id}" \
--header "email: ${user_email}" \
--cert ${cert_location} --key ${key_location}

curl --location "https://${gateway_url}:8444/extapi/organisation/person/${person_id}/summary?search=" \
--header "email: ${user_email}" \
--cert ${cert_location} --key ${key_location}

0 comments on commit 624b700

Please sign in to comment.