aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-06-01 16:07:58 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-06-02 16:57:07 +0200
commit3866ea02d4a5c8e4c69a5d8633a883e3733414b9 (patch)
treeac484fcf59a257ce526888a6b1d4cb8f61b4a49a /server/tests/api/users
parent1cfbdd30d9913bfaa0c7e54f82e5b953646bb0d1 (diff)
downloadPeerTube-3866ea02d4a5c8e4c69a5d8633a883e3733414b9.tar.gz
PeerTube-3866ea02d4a5c8e4c69a5d8633a883e3733414b9.tar.zst
PeerTube-3866ea02d4a5c8e4c69a5d8633a883e3733414b9.zip
correct error codes and backward compat
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/users.ts24
1 files changed, 16 insertions, 8 deletions
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 () {
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.type).to.equal('invalid_client') 96 expect(res.body.code).to.equal('invalid_client')
97 expect(res.body.detail).to.contain('client is invalid') 97 expect(res.body.error).to.contain('client is invalid')
98 expect(res.body.type.startsWith('https://')).to.be.true
99 expect(res.body.type).to.contain('invalid_client')
98 }) 100 })
99 101
100 it('Should not login with an invalid client secret', async function () { 102 it('Should not login with an invalid client secret', async function () {
101 const client = { id: server.client.id, secret: 'coucou' } 103 const client = { id: server.client.id, secret: 'coucou' }
102 const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400) 104 const res = await login(server.url, client, server.user, HttpStatusCode.BAD_REQUEST_400)
103 105
104 expect(res.body.type).to.equal('invalid_client') 106 expect(res.body.code).to.equal('invalid_client')
105 expect(res.body.detail).to.contain('client is invalid') 107 expect(res.body.error).to.contain('client is invalid')
108 expect(res.body.type.startsWith('https://')).to.be.true
109 expect(res.body.type).to.contain('invalid_client')
106 }) 110 })
107 }) 111 })
108 112
@@ -112,16 +116,20 @@ describe('Test users', function () {
112 const user = { username: 'captain crochet', password: server.user.password } 116 const user = { username: 'captain crochet', password: server.user.password }
113 const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) 117 const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400)
114 118
115 expect(res.body.type).to.equal('invalid_grant') 119 expect(res.body.code).to.equal('invalid_grant')
116 expect(res.body.detail).to.contain('credentials are invalid') 120 expect(res.body.error).to.contain('credentials are invalid')
121 expect(res.body.type.startsWith('https://')).to.be.true
122 expect(res.body.type).to.contain('invalid_grant')
117 }) 123 })
118 124
119 it('Should not login with an invalid password', async function () { 125 it('Should not login with an invalid password', async function () {
120 const user = { username: server.user.username, password: 'mew_three' } 126 const user = { username: server.user.username, password: 'mew_three' }
121 const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400) 127 const res = await login(server.url, server.client, user, HttpStatusCode.BAD_REQUEST_400)
122 128
123 expect(res.body.type).to.equal('invalid_grant') 129 expect(res.body.code).to.equal('invalid_grant')
124 expect(res.body.detail).to.contain('credentials are invalid') 130 expect(res.body.error).to.contain('credentials are invalid')
131 expect(res.body.type.startsWith('https://')).to.be.true
132 expect(res.body.type).to.contain('invalid_grant')
125 }) 133 })
126 134
127 it('Should not be able to upload a video', async function () { 135 it('Should not be able to upload a video', async function () {