X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftests%2Fapi%2Fcheck-params%2Ffollows.ts;h=0af1562f5b39d7c7eb829fb150a8a2cdaa7787f9;hb=0f91ae62df8a37194fea84ce1efa9e733d9c1fd8;hp=a215e7b1aa87fa660be1a0e8b8d05f3b23fdf40d;hpb=81de19482b89342c3dbc098a9f512ef7f1056e45;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index a215e7b1a..0af1562f5 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts @@ -166,47 +166,49 @@ describe('Test server follows API validators', function () { }) describe('When removing following', function () { - // it('Should fail with an invalid token', async function () { - // await request(server.url) - // .delete(path + '/1') - // .set('Authorization', 'Bearer faketoken') - // .set('Accept', 'application/json') - // .expect(401) - // }) - // - // it('Should fail if the user is not an administrator', async function () { - // await request(server.url) - // .delete(path + '/1') - // .set('Authorization', 'Bearer ' + userAccessToken) - // .set('Accept', 'application/json') - // .expect(403) - // }) - // - // it('Should fail with an undefined id', async function () { - // await request(server.url) - // .delete(path + '/' + undefined) - // .set('Authorization', 'Bearer ' + server.accessToken) - // .set('Accept', 'application/json') - // .expect(400) - // }) - // - // it('Should fail with an invalid id', async function () { - // await request(server.url) - // .delete(path + '/foobar') - // .set('Authorization', 'Bearer ' + server.accessToken) - // .set('Accept', 'application/json') - // .expect(400) - // }) - // - // it('Should fail we do not follow this server', async function () { - // await request(server.url) - // .delete(path + '/-1') - // .set('Authorization', 'Bearer ' + server.accessToken) - // .set('Accept', 'application/json') - // .expect(404) - // }) - // - // it('Should succeed with the correct parameters') + const path = '/api/v1/server/following' + + it('Should fail with an invalid token', async function () { + await request(server.url) + .delete(path + '/1') + .set('Authorization', 'Bearer faketoken') + .set('Accept', 'application/json') + .expect(401) + }) + + it('Should fail if the user is not an administrator', async function () { + await request(server.url) + .delete(path + '/1') + .set('Authorization', 'Bearer ' + userAccessToken) + .set('Accept', 'application/json') + .expect(403) + }) + + it('Should fail with an undefined id', async function () { + await request(server.url) + .delete(path + '/' + undefined) + .set('Authorization', 'Bearer ' + server.accessToken) + .set('Accept', 'application/json') + .expect(400) + }) + + it('Should fail with an invalid id', async function () { + await request(server.url) + .delete(path + '/foobar') + .set('Authorization', 'Bearer ' + server.accessToken) + .set('Accept', 'application/json') + .expect(400) + }) + + it('Should fail we do not follow this server', async function () { + await request(server.url) + .delete(path + '/-1') + .set('Authorization', 'Bearer ' + server.accessToken) + .set('Accept', 'application/json') + .expect(404) + }) + + it('Should succeed with the correct parameters') }) })