Skip to content

Commit

Permalink
Newer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
William-Edwards-STFC committed Dec 18, 2024
1 parent 9cfeb00 commit fe0da7b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 15 deletions.
24 changes: 18 additions & 6 deletions src/mockserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function mockserver() {
}
if (emails) {
responsePath = `src/responses/user/getbasicpersondetails/${emails[0]}.json`;
}
}
break;
// Break
case '/users-service/v1/basic-person-details/searchable':
Expand All @@ -84,10 +84,14 @@ async function mockserver() {
const RoleTest = roleMappings[request.path.replace('/users-service/v1/sessions/', '')];
responsePath = `src/responses/user/getpersondetailsfromsessionid/${RoleTest}.json`;
break;
case '/users-service/v1/role':
if (userNumber) {
responsePath = `src/responses/user/getrolesforuser/${userNumber}.json`;
}
case '/users-service/v1/role/1':
case '/users-service/v1/role/2':
case '/users-service/v1/role/3':
case '/users-service/v1/role/4':
case '/users-service/v1/role/5':
case '/users-service/v1/role/6':
const RoleDHSH = request.path.replace('/users-service/v1/role/', '');
responsePath = `src/responses/user/getrolesforuser/${RoleDHSH}.json`;
break;
default:
return {
Expand All @@ -109,14 +113,22 @@ async function mockserver() {

return {
statusCode: 200,
headers: {
'Content-Type': ['application/json'],
},
body: file,
};
};

const endpoints = [
'/users-service/v1/basic-person-details',
'/users-service/v1/basic-person-details/searchable',
'/users-service/v1/role',
'/users-service/v1/role/1',
'/users-service/v1/role/2',
'/users-service/v1/role/3',
'/users-service/v1/role/4',
'/users-service/v1/role/5',
'/users-service/v1/role/6',
'/users-service/v1/sessions/user',
'/users-service/v1/sessions/officer',
'/users-service/v1/sessions/reviewer',
Expand Down
18 changes: 18 additions & 0 deletions src/responses/user/getbasicpersondetails/null.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"country": "UNITED KINGDOM",
"deptAcronym": "SCD",
"deptName": "Scientific Computing",
"displayName": "Anders Andersson",
"email": "[email protected]",
"establishmentId": "5",
"familyName": "Carlsson",
"firstNameKnownAs": "Carl",
"fullName": "Mr Carl Carlsson",
"givenName": "Carl",
"initials": "C",
"orgName": "STFC",
"title": "Mr",
"userNumber": "2"
}
]
16 changes: 7 additions & 9 deletions src/responses/user/getpersondetailsfromsessionid/1.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[
{
"userId": "1",
"sessionId": "user",
"lastAccessTime": "2024-12-18T15:07:24.402605019Z",
"loginType": "LDAP",
"comments": null
}
]
{
"userId": "1",
"sessionId": "user",
"lastAccessTime": "2024-12-18T15:07:24.402605019Z",
"loginType": "LDAP",
"comments": null
}
3 changes: 3 additions & 0 deletions src/responses/user/getpersondetailsfromsessionid/null.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"userId": "2"
}
5 changes: 5 additions & 0 deletions src/responses/user/getrolesforuser/null.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"name": "User Officer"
}
]
18 changes: 18 additions & 0 deletions src/responses/user/getsearchablebasicpersondetails/null.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"country": "UNITED KINGDOM",
"deptAcronym": "SCD",
"deptName": "Scientific Computing",
"displayName": "Anders Andersson",
"email": "[email protected]",
"establishmentId": "5",
"familyName": "Carlsson",
"firstNameKnownAs": "Carl",
"fullName": "Mr Carl Carlsson",
"givenName": "Carl",
"initials": "C",
"orgName": "STFC",
"title": "Mr",
"userNumber": "2"
}
]

0 comments on commit fe0da7b

Please sign in to comment.