]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-playlists.ts
Add playback metric endpoint sent to OTEL
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-playlists.ts
index e0e42ebb08445dcea6ee1b2216f38e780c772efe..8db91a3f9821a6f1eddfbf70c45cbf226fe43d54 100644 (file)
@@ -1,20 +1,9 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
-import { HttpStatusCode } from '@shared/core-utils'
-import {
-  checkBadCountPagination,
-  checkBadSortPagination,
-  checkBadStartPagination,
-  cleanupTests,
-  flushAndRunServer,
-  makeGetRequest,
-  PlaylistsCommand,
-  ServerInfo,
-  setAccessTokensToServers,
-  setDefaultVideoChannel
-} from '@shared/extra-utils'
+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
 import {
+  HttpStatusCode,
   VideoPlaylistCreate,
   VideoPlaylistCreateResult,
   VideoPlaylistElementCreate,
@@ -23,9 +12,18 @@ import {
   VideoPlaylistReorder,
   VideoPlaylistType
 } from '@shared/models'
+import {
+  cleanupTests,
+  createSingleServer,
+  makeGetRequest,
+  PeerTubeServer,
+  PlaylistsCommand,
+  setAccessTokensToServers,
+  setDefaultVideoChannel
+} from '@shared/server-commands'
 
 describe('Test video playlists API validator', function () {
-  let server: ServerInfo
+  let server: PeerTubeServer
   let userAccessToken: string
 
   let playlist: VideoPlaylistCreateResult
@@ -42,7 +40,7 @@ describe('Test video playlists API validator', function () {
   before(async function () {
     this.timeout(30000)
 
-    server = await flushAndRunServer(1)
+    server = await createSingleServer(1)
 
     await setAccessTokensToServers([ server ])
     await setDefaultVideoChannel([ server ])
@@ -119,7 +117,7 @@ describe('Test video playlists API validator', function () {
       await makeGetRequest({
         url: server.url,
         path: accountPath,
-        statusCodeExpected: HttpStatusCode.NOT_FOUND_404,
+        expectedStatus: HttpStatusCode.NOT_FOUND_404,
         token: server.accessToken
       })
     })
@@ -130,18 +128,18 @@ describe('Test video playlists API validator', function () {
       await makeGetRequest({
         url: server.url,
         path: accountPath,
-        statusCodeExpected: HttpStatusCode.NOT_FOUND_404,
+        expectedStatus: HttpStatusCode.NOT_FOUND_404,
         token: server.accessToken
       })
     })
 
     it('Should success with the correct parameters', async function () {
-      await makeGetRequest({ url: server.url, path: globalPath, statusCodeExpected: HttpStatusCode.OK_200, token: server.accessToken })
-      await makeGetRequest({ url: server.url, path: accountPath, statusCodeExpected: HttpStatusCode.OK_200, token: server.accessToken })
+      await makeGetRequest({ url: server.url, path: globalPath, expectedStatus: HttpStatusCode.OK_200, token: server.accessToken })
+      await makeGetRequest({ url: server.url, path: accountPath, expectedStatus: HttpStatusCode.OK_200, token: server.accessToken })
       await makeGetRequest({
         url: server.url,
         path: videoChannelPath,
-        statusCodeExpected: HttpStatusCode.OK_200,
+        expectedStatus: HttpStatusCode.OK_200,
         token: server.accessToken
       })
     })
@@ -159,7 +157,7 @@ describe('Test video playlists API validator', function () {
     })
 
     it('Should success with the correct parameters', async function () {
-      await makeGetRequest({ url: server.url, path: path + playlist.shortUUID + '/videos', statusCodeExpected: HttpStatusCode.OK_200 })
+      await makeGetRequest({ url: server.url, path: path + playlist.shortUUID + '/videos', expectedStatus: HttpStatusCode.OK_200 })
     })
   })
 
@@ -211,7 +209,7 @@ describe('Test video playlists API validator', function () {
       }
     }
     const getUpdate = (params: any, playlistId: number | string) => {
-      return { ...params, playlistId: playlistId }
+      return { ...params, playlistId }
     }
 
     it('Should fail with an unauthenticated user', async function () {
@@ -580,7 +578,7 @@ describe('Test video playlists API validator', function () {
         url: server.url,
         path,
         query: { videoIds: [ 1, 2 ] },
-        statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
+        expectedStatus: HttpStatusCode.UNAUTHORIZED_401
       })
     })
 
@@ -613,7 +611,7 @@ describe('Test video playlists API validator', function () {
         token: server.accessToken,
         path,
         query: { videoIds: [ 1, 2 ] },
-        statusCodeExpected: HttpStatusCode.OK_200
+        expectedStatus: HttpStatusCode.OK_200
       })
     })
   })