From 3866ea02d4a5c8e4c69a5d8633a883e3733414b9 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 1 Jun 2021 16:07:58 +0200 Subject: correct error codes and backward compat --- server/tests/api/users/users.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 363236b62..464c11d34 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -93,16 +93,20 @@ describe('Test users', function () { const client = { id: 'client', secret: server.client.secret } const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) - expect(res.body.type).to.equal('invalid_client') - expect(res.body.detail).to.contain('client is invalid') + expect(res.body.code).to.equal('invalid_client') + expect(res.body.error).to.contain('client is invalid') + expect(res.body.type.startsWith('https://')).to.be.true + expect(res.body.type).to.contain('invalid_client') }) it('Should not login with an invalid client secret', async function () { const client = { id: server.client.id, secret: 'coucou' } const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) - expect(res.body.type).to.equal('invalid_client') - expect(res.body.detail).to.contain('client is invalid') + expect(res.body.code).to.equal('invalid_client') + expect(res.body.error).to.contain('client is invalid') + expect(res.body.type.startsWith('https://')).to.be.true + expect(res.body.type).to.contain('invalid_client') }) }) @@ -112,16 +116,20 @@ describe('Test users', function () { const user = { username: 'captain crochet', password: server.user.password } const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) - expect(res.body.type).to.equal('invalid_grant') - expect(res.body.detail).to.contain('credentials are invalid') + expect(res.body.code).to.equal('invalid_grant') + expect(res.body.error).to.contain('credentials are invalid') + expect(res.body.type.startsWith('https://')).to.be.true + expect(res.body.type).to.contain('invalid_grant') }) it('Should not login with an invalid password', async function () { const user = { username: server.user.username, password: 'mew_three' } const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) - expect(res.body.type).to.equal('invalid_grant') - expect(res.body.detail).to.contain('credentials are invalid') + expect(res.body.code).to.equal('invalid_grant') + expect(res.body.error).to.contain('credentials are invalid') + expect(res.body.type.startsWith('https://')).to.be.true + expect(res.body.type).to.contain('invalid_grant') }) it('Should not be able to upload a video', async function () { -- cgit v1.2.3