aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
authorGreen-Star <Green-Star@users.noreply.github.com>2017-08-02 21:50:42 +0200
committerBigard Florian <florian.bigard@gmail.com>2017-08-02 21:50:42 +0200
commitd5f5a670fcf6258d0facf9a2fd3aabd550fbc78f (patch)
treebc945e1b6ab0f9cb36a481fea56cdfdaa8b1a341 /server/tests/utils
parent291e8d3eed88fe714fb74ad897ac2c67347a85ff (diff)
downloadPeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.gz
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.zst
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.zip
Remove one pod (#76)
* Client: Fix typo * Client: Add removeFriend feature * Server: Add removeFriend feature * Server: Update method name * Fix rebase onto develop issues * Server: Fix error message * Server: Remove useless methods in removeFriend method * Server: Finish remove on pod feature after rebase * Server: Type pod parameter * Fix Travis build * Add friend-basic test for the remove one pod feature * Add check-params tests for the remove one pod feature * Fix typos * Add friend-advanced test for the remove one pod feature * Client: Trailing new line * Move to promises * Add undefined id test * Use find method instead of a for loop to find the friend to remove * Remove setTimeout method * Server: Remove requestScheduler operations * Server: Fix logging messages * Server: Remove sign request parameter
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/pods.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/server/tests/utils/pods.js b/server/tests/utils/pods.js
index 25b97edec..cdabb64a6 100644
--- a/server/tests/utils/pods.js
+++ b/server/tests/utils/pods.js
@@ -5,7 +5,8 @@ const request = require('supertest')
5const podsUtils = { 5const podsUtils = {
6 getFriendsList, 6 getFriendsList,
7 makeFriends, 7 makeFriends,
8 quitFriends 8 quitFriends,
9 quitOneFriend
9} 10}
10 11
11// ---------------------- Export functions -------------------- 12// ---------------------- Export functions --------------------
@@ -90,6 +91,26 @@ function quitFriends (url, accessToken, expectedStatus, end) {
90 }) 91 })
91} 92}
92 93
94function quitOneFriend (url, accessToken, friendId, expectedStatus, end) {
95 if (!end) {
96 end = expectedStatus
97 expectedStatus = 204
98 }
99
100 const path = '/api/v1/pods/' + friendId
101
102 request(url)
103 .delete(path)
104 .set('Accept', 'application/json')
105 .set('Authorization', 'Bearer ' + accessToken)
106 .expect(expectedStatus)
107 .end(function (err, res) {
108 if (err) throw err
109
110 end()
111 })
112}
113
93// --------------------------------------------------------------------------- 114// ---------------------------------------------------------------------------
94 115
95module.exports = podsUtils 116module.exports = podsUtils