diff options
Diffstat (limited to 'server/tests/api/users')
-rw-r--r-- | server/tests/api/users/users-verification.ts | 5 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 16 |
2 files changed, 11 insertions, 10 deletions
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index 1a9a519a0..e0f2f2112 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts | |||
@@ -19,6 +19,7 @@ import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/l | |||
19 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' | 19 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' |
20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
21 | import { User } from '../../../../shared/models/users' | 21 | import { User } from '../../../../shared/models/users' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | const expect = chai.expect | 24 | const expect = chai.expect |
24 | 25 | ||
@@ -89,8 +90,8 @@ describe('Test users account verification', function () { | |||
89 | }) | 90 | }) |
90 | 91 | ||
91 | it('Should not allow login for user with unverified email', async function () { | 92 | it('Should not allow login for user with unverified email', async function () { |
92 | const resLogin = await login(server.url, server.client, user1, 400) | 93 | const resLogin = await login(server.url, server.client, user1, HttpStatusCode.BAD_REQUEST_400) |
93 | expect(resLogin.body.error).to.contain('User email is not verified.') | 94 | expect(resLogin.body.detail).to.contain('User email is not verified.') |
94 | }) | 95 | }) |
95 | 96 | ||
96 | it('Should verify the user via email and allow login', async function () { | 97 | it('Should verify the user via email and allow login', async function () { |
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index cea98aac7..363236b62 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -93,16 +93,16 @@ describe('Test users', function () { | |||
93 | const client = { id: 'client', secret: server.client.secret } | 93 | const client = { id: 'client', secret: server.client.secret } |
94 | const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) | 94 | const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) |
95 | 95 | ||
96 | expect(res.body.code).to.equal('invalid_client') | 96 | expect(res.body.type).to.equal('invalid_client') |
97 | expect(res.body.error).to.contain('client is invalid') | 97 | expect(res.body.detail).to.contain('client is invalid') |
98 | }) | 98 | }) |
99 | 99 | ||
100 | it('Should not login with an invalid client secret', async function () { | 100 | it('Should not login with an invalid client secret', async function () { |
101 | const client = { id: server.client.id, secret: 'coucou' } | 101 | const client = { id: server.client.id, secret: 'coucou' } |
102 | const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) | 102 | const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) |
103 | 103 | ||
104 | expect(res.body.code).to.equal('invalid_client') | 104 | expect(res.body.type).to.equal('invalid_client') |
105 | expect(res.body.error).to.contain('client is invalid') | 105 | expect(res.body.detail).to.contain('client is invalid') |
106 | }) | 106 | }) |
107 | }) | 107 | }) |
108 | 108 | ||
@@ -112,16 +112,16 @@ describe('Test users', function () { | |||
112 | const user = { username: 'captain crochet', password: server.user.password } | 112 | const user = { username: 'captain crochet', password: server.user.password } |
113 | const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) | 113 | const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) |
114 | 114 | ||
115 | expect(res.body.code).to.equal('invalid_grant') | 115 | expect(res.body.type).to.equal('invalid_grant') |
116 | expect(res.body.error).to.contain('credentials are invalid') | 116 | expect(res.body.detail).to.contain('credentials are invalid') |
117 | }) | 117 | }) |
118 | 118 | ||
119 | it('Should not login with an invalid password', async function () { | 119 | it('Should not login with an invalid password', async function () { |
120 | const user = { username: server.user.username, password: 'mew_three' } | 120 | const user = { username: server.user.username, password: 'mew_three' } |
121 | const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) | 121 | const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) |
122 | 122 | ||
123 | expect(res.body.code).to.equal('invalid_grant') | 123 | expect(res.body.type).to.equal('invalid_grant') |
124 | expect(res.body.error).to.contain('credentials are invalid') | 124 | expect(res.body.detail).to.contain('credentials are invalid') |
125 | }) | 125 | }) |
126 | 126 | ||
127 | it('Should not be able to upload a video', async function () { | 127 | it('Should not be able to upload a video', async function () { |