Skip to content

Commit 624b700

Browse files
Merge pull request #96 from DEFRA/fix/set-LOG_LEVEL+test-scripts
Fix/set log level+test scripts
2 parents 53c54dc + 2884c19 commit 624b700

File tree

7 files changed

+116
-3
lines changed

7 files changed

+116
-3
lines changed

appConfig/appConfig.dev1.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
value: "dev1"
1313
- key: HEALTH_CHECK_ENABLED
1414
value: "false"
15+
- key: LOG_LEVEL
16+
value: "http"
1517

1618
# Secrets
1719
- key: API_TENANT_ID

appConfig/appConfig.prd1.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
value: "prd1"
1313
- key: HEALTH_CHECK_ENABLED
1414
value: "true"
15+
- key: LOG_LEVEL
16+
value: "http"
1517

1618
# Secrets
1719
- key: API_TENANT_ID

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fcp-data-access-layer-api",
3-
"version": "1.3.24",
3+
"version": "1.3.26",
44
"description": "Customer Registry GraphQL Service",
55
"homepage": "https://github.com/DEFRA/fcp-data-access-layer-api",
66
"main": "app/index.js",

test_scripts/apim-test.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Generate token
2+
token_request=$(curl --location "https://login.microsoftonline.com/${apim_tenant_id}/oauth2/v2.0/token" \
3+
--header 'content-type: application/x-www-form-urlencoded' \
4+
--data-urlencode 'grant_type=client_credentials' \
5+
--data-urlencode "scope=${apim_scope}" \
6+
-u "${apim_client_id}:${apim_client_secret}")
7+
8+
token=$(jq -r '.access_token' <<< "${token_request}")
9+
echo "Token: ${token}"
10+
11+
12+
curl --location "https://${apim_url}/person/search" \
13+
--header "email: ${user_email}" \
14+
--header 'Content-Type: application/json' \
15+
--data '{
16+
"offset": 0,
17+
"limit": 20,
18+
"searchFieldType": "CUSTOMER_REFERENCE",
19+
"primarySearchPhrase": "1103020285",
20+
"secondarySearchPhrase": null
21+
}' \
22+
--header "Authorization: Bearer ${token}" \
23+
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"
24+
25+
curl --location "https://${apim_url}/organisation/search" \
26+
--header "email: ${user_email}" \
27+
--header 'Content-Type: application/json' \
28+
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \
29+
--header "Authorization: Bearer ${token}" \
30+
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"
31+
32+
curl --location "https://${apim_url}/authorisation/organisation/${org_id}" \
33+
--header "email: ${user_email}" \
34+
--header "Authorization: Bearer ${token}" \
35+
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"
36+
37+
curl --location "https://${apim_url}/organisation/person/${person_id}/summary?search=" \
38+
--header "email: ${user_email}" \
39+
--header "Authorization: Bearer ${token}" \
40+
--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}"

test_scripts/dal-test.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Generate token
2+
token_request=$(curl --location "https://login.microsoftonline.com/${dal_tenant_id}/oauth2/v2.0/token" \
3+
--header 'content-type: application/x-www-form-urlencoded' \
4+
--data-urlencode 'grant_type=client_credentials' \
5+
--data-urlencode "scope=${dal_scope}" \
6+
-u "${dal_client_id}:${dal_client_secret}")
7+
8+
token=$(jq -r '.access_token' <<< "${token_request}")
9+
echo "Token: ${token}"
10+
11+
12+
# Authenticate questions
13+
curl --location "${dal_url}" \
14+
--header 'Content-Type: application/json' \
15+
--header "Authorization: Bearer ${token}" \
16+
--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"}}'
17+
18+
# Customer businesses
19+
curl --location "${dal_url}" \
20+
--header "Email: ${user_email}" \
21+
--header 'Content-Type: application/json' \
22+
--header "Authorization: Bearer ${token}" \
23+
--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"}}'
24+
25+
# Customer permissions
26+
curl --location "${dal_url}" \
27+
--header "Email: ${user_email}" \
28+
--header 'Content-Type: application/json' \
29+
--header "Authorization: Bearer ${token}" \
30+
--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"}}'
31+
32+
# Business customers
33+
curl --location 'https://fcp-data-access-layer-api.tst1.adp.defra.gov.uk/graphql' \
34+
--header "Email: ${user_email}" \
35+
--header 'Content-Type: application/json' \
36+
--header "Authorization: Bearer ${token}" \
37+
--data '{"query":"query BusinessCustomers ($sbi: ID!) {\n business(sbi: $sbi) {\n customers {\n firstName\n lastName\n crn\n }\n }\n}","variables":{"sbi":"107591843"}}'
38+
39+
# Business customer permissions
40+
curl --location "${dal_url}" \
41+
--header "Email: ${user_email}" \
42+
--header 'Content-Type: application/json' \
43+
--header "Authorization: Bearer ${token}" \
44+
--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"}}'

test_scripts/kits-gateway-test.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
curl --location "https://${gateway_url}:8444/extapi/person/search" \
2+
--header "email: ${user_email}" \
3+
--header 'Content-Type: application/json' \
4+
--data '{
5+
"offset": 0,
6+
"limit": 20,
7+
"searchFieldType": "CUSTOMER_REFERENCE",
8+
"primarySearchPhrase": "1103020285",
9+
"secondarySearchPhrase": null
10+
}' \
11+
--cert ${cert_location} --key ${key_location}
12+
13+
curl --location "https://${gateway_url}:8444/extapi/organisation/search" \
14+
--header "email: ${user_email}" \
15+
--header 'Content-Type: application/json' \
16+
--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \
17+
--cert ${cert_location} --key ${key_location}
18+
19+
curl --location "https://${gateway_url}:8444/extapi/authorisation/organisation/${org_id}" \
20+
--header "email: ${user_email}" \
21+
--cert ${cert_location} --key ${key_location}
22+
23+
curl --location "https://${gateway_url}:8444/extapi/organisation/person/${person_id}/summary?search=" \
24+
--header "email: ${user_email}" \
25+
--cert ${cert_location} --key ${key_location}

0 commit comments

Comments
 (0)