aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r--server/tests/api/utils.js13
1 files changed, 10 insertions, 3 deletions
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) {
97 }) 97 })
98} 98}
99 99
100function makeFriends (url, expectedStatus, callback) { 100function makeFriends (url, accessToken, expectedStatus, callback) {
101 if (!callback) { 101 if (!callback) {
102 callback = expectedStatus 102 callback = expectedStatus
103 expectedStatus = 204 103 expectedStatus = 204
@@ -109,6 +109,7 @@ function makeFriends (url, expectedStatus, callback) {
109 request(url) 109 request(url)
110 .get(path) 110 .get(path)
111 .set('Accept', 'application/json') 111 .set('Accept', 'application/json')
112 .set('Authorization', 'Bearer ' + accessToken)
112 .expect(expectedStatus) 113 .expect(expectedStatus)
113 .end(function (err, res) { 114 .end(function (err, res) {
114 if (err) throw err 115 if (err) throw err
@@ -118,14 +119,20 @@ function makeFriends (url, expectedStatus, callback) {
118 }) 119 })
119} 120}
120 121
121function quitFriends (url, callback) { 122function quitFriends (url, accessToken, expectedStatus, callback) {
123 if (!callback) {
124 callback = expectedStatus
125 expectedStatus = 204
126 }
127
122 const path = '/api/v1/pods/quitfriends' 128 const path = '/api/v1/pods/quitfriends'
123 129
124 // The first pod make friend with the third 130 // The first pod make friend with the third
125 request(url) 131 request(url)
126 .get(path) 132 .get(path)
127 .set('Accept', 'application/json') 133 .set('Accept', 'application/json')
128 .expect(204) 134 .set('Authorization', 'Bearer ' + accessToken)
135 .expect(expectedStatus)
129 .end(function (err, res) { 136 .end(function (err, res) {
130 if (err) throw err 137 if (err) throw err
131 138