Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Fix functional test server to check for correct roles
Browse files Browse the repository at this point in the history
This modification makes sure that all requests to do
association/dissociation of roles use the right api key for the role.

This will break tests because currently the code doesn't use the right
api key for role modification
  • Loading branch information
James C. Scott committed Jun 14, 2017
1 parent fff18c9 commit 1fa6728
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions static_src/test/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,17 @@ module.exports = function api(smocks) {
path: `${BASE_URL}/organizations/{orgGuid}/{role}/{userGuid}`,
handler: function (req, reply) {
const orgGuid = req.params.orgGuid;
const role = req.params.role;
const user = userRoleOrgAddNewRole(orgGuid);

reply(SingleResponse(user));
switch (role) {
case 'org_managers':
case 'org_auditors':
case 'billing_managers':
reply(SingleResponse(user));
break;
default:
reply().code(500);
}
}
});

Expand All @@ -343,7 +351,16 @@ module.exports = function api(smocks) {
method: 'DELETE',
path: `${BASE_URL}/organizations/{orgGuid}/{role}/{userGuid}`,
handler: function (req, reply) {
reply(SingleResponse({}));
const role = req.params.role;
switch (role) {
case 'org_managers':
case 'org_auditors':
case 'billing_managers':
reply(SingleResponse({}));
break;
default:
reply().code(500);
}
}
});

Expand Down Expand Up @@ -444,7 +461,16 @@ module.exports = function api(smocks) {
method: 'PUT',
path: `${BASE_URL}/spaces/{spaceGuid}/{role}/{userGuid}`,
handler: function (req, reply) {
reply(SingleResponse({}));
const role = req.params.role;
switch (role) {
case 'managers':
case 'auditors':
case 'developers':
reply(SingleResponse({}));
break;
default:
reply().code(500);
}
}
});

Expand All @@ -454,7 +480,16 @@ module.exports = function api(smocks) {
method: 'DELETE',
path: `${BASE_URL}/spaces/{spaceGuid}/{role}/{userGuid}`,
handler: function (req, reply) {
reply(SingleResponse({}));
const role = req.params.role;
switch (role) {
case 'managers':
case 'auditors':
case 'developers':
reply(SingleResponse({}));
break;
default:
reply().code(500);
}
}
});

Expand Down

0 comments on commit 1fa6728

Please sign in to comment.