Skip to content

Commit

Permalink
Use User.Ids in credentials checks
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed Oct 30, 2017
1 parent 0d3f314 commit 8d88cae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/services/auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ describe('Auth tests', function () {
});

it('should authorize Credential with scopes', () => {
return authService.authorizeCredential(user.username, 'oauth2', ['someScope1', 'someScope2'])
return authService.authorizeCredential(userFromDb.id, 'oauth2', ['someScope1', 'someScope2'])
.then((authResponse) => {
should.exist(authResponse);
authResponse.should.eql(true);
});
});

it('should not authorize Credential with invalid scopes', () => {
return authService.authorizeCredential(user.username, 'oauth2', ['otherScope', 'someScope2'])
return authService.authorizeCredential(userFromDb.id, 'oauth2', ['otherScope', 'someScope2'])
.then((authResponse) => {
should.exist(authResponse);
authResponse.should.eql(false);
Expand All @@ -114,19 +114,19 @@ describe('Auth tests', function () {

it('should not authorize Credential that is inActive', () => {
return credentialService
.deactivateCredential(user.username, 'oauth2')
.deactivateCredential(userFromDb.id, 'oauth2')
.then(function (res) {
should.exist(res);
res.should.eql(true);
})
.then(() => authService.authorizeCredential(user.username, 'oauth2', ['otherScope', 'someScope2']))
.then(() => authService.authorizeCredential(userFromDb.id, 'oauth2', ['otherScope', 'someScope2']))
.then((authResponse) => {
should.exist(authResponse);
authResponse.should.eql(false);

// reset credential back to active status
return credentialService
.activateCredential(user.username, 'oauth2')
.activateCredential(userFromDb.id, 'oauth2')
.then(function (res) {
should.exist(res);
res.should.eql(true);
Expand Down

0 comments on commit 8d88cae

Please sign in to comment.