X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Futils.js;h=9c5e4ee61cf7b4ff5263e466f6c2c51381d86dcb;hb=b3b926474204ad736ec434aafc8afc6bc55079f6;hp=45f11ac8f36ce57fc51b464d8ba538b2f5099532;hpb=5dda52c924763a889e98b4cf97c588b34ef01812;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index 45f11ac8f..9c5e4ee61 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js @@ -97,7 +97,7 @@ function loginAndGetAccessToken (server, callback) { }) } -function makeFriends (url, expectedStatus, callback) { +function makeFriends (url, accessToken, expectedStatus, callback) { if (!callback) { callback = expectedStatus expectedStatus = 204 @@ -109,6 +109,7 @@ function makeFriends (url, expectedStatus, callback) { request(url) .get(path) .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + accessToken) .expect(expectedStatus) .end(function (err, res) { if (err) throw err @@ -118,14 +119,20 @@ function makeFriends (url, expectedStatus, callback) { }) } -function quitFriends (url, callback) { +function quitFriends (url, accessToken, expectedStatus, callback) { + if (!callback) { + callback = expectedStatus + expectedStatus = 204 + } + const path = '/api/v1/pods/quitfriends' // The first pod make friend with the third request(url) .get(path) .set('Accept', 'application/json') - .expect(204) + .set('Authorization', 'Bearer ' + accessToken) + .expect(expectedStatus) .end(function (err, res) { if (err) throw err