Add pod list endpoint with pagination, sort...
[oweals/peertube.git] / server / tests / utils / pods.ts
index 0bea6db9782f8a73a636f49c5991facecc44d555..52e807e70e9f1a621a71febb57245eb1e298b182 100644 (file)
@@ -12,6 +12,19 @@ function getFriendsList (url: string) {
           .expect('Content-Type', /json/)
 }
 
+function getPodsListPaginationAndSort (url: string, start: number, count: number, sort: string) {
+  const path = '/api/v1/pods/'
+
+  return request(url)
+    .get(path)
+    .query({ start })
+    .query({ count })
+    .query({ sort })
+    .set('Accept', 'application/json')
+    .expect(200)
+    .expect('Content-Type', /json/)
+}
+
 async function makeFriends (url: string, accessToken: string, expectedStatus = 204) {
   // Which pod makes friends with which pod
   const friendsMatrix = {
@@ -37,7 +50,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
       'localhost:9003'
     ]
   }
-  const path = '/api/v1/pods/makefriends'
+  const path = '/api/v1/pods/make-friends'
 
   // The first pod make friend with the third
   const res = await request(url)
@@ -54,7 +67,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
 }
 
 async function quitFriends (url: string, accessToken: string, expectedStatus = 204) {
-  const path = '/api/v1/pods/quitfriends'
+  const path = '/api/v1/pods/quit-friends'
 
   // The first pod make friend with the third
   const res = await request(url)
@@ -85,5 +98,6 @@ export {
   getFriendsList,
   makeFriends,
   quitFriends,
-  quitOneFriend
+  quitOneFriend,
+  getPodsListPaginationAndSort
 }