Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UML-3394 Update mock services with new/revised data and functionality #3031

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion mock-integrations/lpa-data-store/mock-responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
address: {
line1: "74 Cloob Close",
town: "Mahhhhhhhhhh",
postcode: "TP6 8EX",
country: "GB"
},
dateOfBirth: "1970-01-24",
Expand All @@ -68,12 +69,27 @@
address: {
line1: "81 NighOnTimeWeBuiltIt Street",
town: "Mahhhhhhhhhh",
postcode: "PC4 6UZ",
country: "GB"
},
dateOfBirth: "1982-07-24",
status: "active",
channel: "paper",
signedAt: "2024-01-10T23:00:00Z"
},
{
uid: "9201a0b8-70a2-47db-93f2-c7510b4210ae",
firstNames: "Jessica",
lastName: "Seakrest",
address: {
line1: "81 NighOnTimeWeBuiltIt Street",
town: "Mahhhhhhhhhh",
country: "GB"
},
dateOfBirth: "1984-04-13",
status: "replacement",
channel: "online",
signedAt: "2024-01-10T23:00:00Z"
}
],
trustCorporations: [
Expand Down Expand Up @@ -120,7 +136,7 @@
UX3_default
];
var getLpa = (uid) => {
const lpas = self.getList([uid]);
const lpas = getList([uid]);
return lpas.lpas.pop();
};
var getList = (uids) => {
Expand Down
16 changes: 16 additions & 0 deletions mock-integrations/lpa-data-store/src/lpas/4UX3.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"address": {
"line1": "74 Cloob Close",
"town": "Mahhhhhhhhhh",
"postcode": "TP6 8EX",
"country": "GB"
},
"dateOfBirth": "1970-01-24",
Expand All @@ -30,12 +31,27 @@
"address": {
"line1": "81 NighOnTimeWeBuiltIt Street",
"town": "Mahhhhhhhhhh",
"postcode": "PC4 6UZ",
"country": "GB"
},
"dateOfBirth": "1982-07-24",
"status": "active",
"channel": "paper",
"signedAt": "2024-01-10T23:00:00Z"
},
{
"uid": "9201a0b8-70a2-47db-93f2-c7510b4210ae",
"firstNames": "Jessica",
"lastName": "Seakrest",
"address": {
"line1": "81 NighOnTimeWeBuiltIt Street",
"town": "Mahhhhhhhhhh",
"country": "GB"
},
"dateOfBirth": "1984-04-13",
"status": "replacement",
"channel": "online",
"signedAt": "2024-01-10T23:00:00Z"
}
],
"trustCorporations": [
Expand Down
2 changes: 1 addition & 1 deletion mock-integrations/lpa-data-store/src/lpas/lpas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const lpaData = [
]

const getLpa = uid => {
const lpas = self.getList([uid])
const lpas = getList([uid])

return lpas.lpas.pop()
}
Expand Down
1 change: 0 additions & 1 deletion mock-integrations/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ map $request_uri $swagger_example {
"~700000000252" "lpa0252";
"~700000000138" "lpa0138";
"~700000000047" "lpa0047";

# 404 - results in a "waiting" status in Make
# NB there doesn't seem to be a way to supply an example for a non-200
# response so we just request an example which doesn't exist, which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ for n in $(cat list.txt )
do
echo "Working on $n..."
example_name="lpa${n: -4:4}"
lpa_yaml_data=$(python3 ../../../scripts/call-api-gateway/call_api_gateway.py $n | yq -P)
lpa_yaml_data=$(\
python3 ../../../scripts/call-api-gateway/call_api_gateway.py $n | \
yq '(.. | select(key == "uId")) |= sub("-", "")' -P \
)
lpa_example_name=$example_name lpa_data=$lpa_yaml_data \
yq 'with(.paths[].get.responses.[].content.[].examples; . | .[env(lpa_example_name)].value=env(lpa_data))' \
temp.yaml >> temp.yaml
sed -i '' -e "5s/^//p; 6s/^.*/ \"~$n\" \"$example_name\";/" ../../nginx.conf
sed -i '' -e "5s/^//p; 6s/^.*/ \"~$n\" \"$example_name\";/" nginx.conf
done

yq ea '. as $item ireduce ({}; . * $item )' temp.yaml > ../mock-openapi-examples.yaml

mv nginx.conf ../../nginx.conf
rm -f temp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ server {

location /v1/use-an-lpa/lpas/ {
rewrite ^/v1(.*)$ $1 last;
}

location /use-an-lpa/lpas/ {
proxy_set_header Prefer example=$swagger_example;
proxy_pass http://mock-data-lpa:4010;
}

location /v1/image-request/ {
proxy_pass http://mock-image-request-handler:8080;
proxy_pass http://mock-image-request-handler:4012;
}

location / {
root /var/www/html;
}
}
Loading