Skip to content

Commit

Permalink
Further WWW-Authenticate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrancis committed Aug 2, 2024
1 parent 34fb33f commit ddf2757
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/integration/oauth-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ describe('oauth/', function () {
let res = await chai

Check failure on line 169 in src/test/integration/oauth-test.ts

View workflow job for this annotation

GitHub Actions / build (10)

'res' is never reassigned. Use 'const' instead

Check failure on line 169 in src/test/integration/oauth-test.ts

View workflow job for this annotation

GitHub Actions / build (12)

'res' is never reassigned. Use 'const' instead

Check failure on line 169 in src/test/integration/oauth-test.ts

View workflow job for this annotation

GitHub Actions / build (14)

'res' is never reassigned. Use 'const' instead
.request(server)
.get(Constants.THINGS_PATH)
.set('Accept', 'application/json')
.set('Accept', 'application/json');
expect(res.status).toEqual(401);
expect(res.header).toHaveProperty('www-authenticate');
expect(res.get('WWW-Authenticate')).toEqual('Bearer');
});

Expand Down Expand Up @@ -217,6 +218,7 @@ describe('oauth/', function () {
.set(...headerAuth(jwt));
expect(err.status).toEqual(403);
expect(err.header).toHaveProperty('www-authenticate');
expect(err.get('www-authenticate')).toEqual(expect.stringContaining('insufficient_scope'));

res = await chai
.request(server)
Expand Down Expand Up @@ -503,6 +505,7 @@ describe('oauth/', function () {
.set(...headerAuth(jwt));
expect(err.status).toEqual(403);
expect(err.header).toHaveProperty('www-authenticate');
expect(err.get('www-authenticate')).toEqual(expect.stringContaining('insufficient_scope'));
});

it('rejects use of authorization code as access token', async () => {
Expand Down Expand Up @@ -537,5 +540,6 @@ describe('oauth/', function () {
.set(...headerAuth(jwt));
expect(err.status).toEqual(403);
expect(err.header).toHaveProperty('www-authenticate');
expect(err.get('www-authenticate')).toEqual(expect.stringContaining('insufficient_scope'));
});
});

0 comments on commit ddf2757

Please sign in to comment.