Playlist server API
[oweals/peertube.git] / server / tests / api / videos / video-playlists.ts
1 /* tslint:disable:no-unused-expression */
2
3 import * as chai from 'chai'
4 import 'mocha'
5 import { join } from 'path'
6 import * as request from 'supertest'
7 import { VideoPrivacy } from '../../../../shared/models/videos'
8 import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
9 import {
10   addVideoChannel,
11   checkTmpIsEmpty,
12   checkVideoFilesWereRemoved,
13   completeVideoCheck,
14   createUser,
15   dateIsValid,
16   doubleFollow,
17   flushAndRunMultipleServers,
18   flushTests,
19   getLocalVideos,
20   getVideo,
21   getVideoChannelsList,
22   getVideosList,
23   killallServers,
24   rateVideo,
25   removeVideo,
26   ServerInfo,
27   setAccessTokensToServers,
28   testImage,
29   updateVideo,
30   uploadVideo,
31   userLogin,
32   viewVideo,
33   wait,
34   webtorrentAdd
35 } from '../../../../shared/utils'
36 import {
37   addVideoCommentReply,
38   addVideoCommentThread,
39   deleteVideoComment,
40   getVideoCommentThreads,
41   getVideoThreadComments
42 } from '../../../../shared/utils/videos/video-comments'
43 import { waitJobs } from '../../../../shared/utils/server/jobs'
44
45 const expect = chai.expect
46
47 describe('Test video playlists', function () {
48   let servers: ServerInfo[] = []
49
50   before(async function () {
51     this.timeout(120000)
52
53     servers = await flushAndRunMultipleServers(3)
54
55     // Get the access tokens
56     await setAccessTokensToServers(servers)
57
58     // Server 1 and server 2 follow each other
59     await doubleFollow(servers[0], servers[1])
60     // Server 1 and server 3 follow each other
61     await doubleFollow(servers[0], servers[2])
62   })
63
64   it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () {
65
66   })
67
68   it('Should create a playlist on server 2 and have the playlist on server 1 but not on server 3', async function () {
69     // create 2 playlists (with videos and no videos)
70     // With thumbnail and no thumbnail
71   })
72
73   it('Should have the playlist on server 3 after a new follow', async function () {
74     // Server 2 and server 3 follow each other
75     await doubleFollow(servers[1], servers[2])
76   })
77
78   it('Should create some playlists and list them correctly', async function () {
79     // create 3 playlists with some videos in it
80     // check pagination
81     // check sort
82     // check empty
83   })
84
85   it('Should list video channel playlists', async function () {
86     // check pagination
87     // check sort
88     // check empty
89   })
90
91   it('Should list account playlists', async function () {
92     // check pagination
93     // check sort
94     // check empty
95   })
96
97   it('Should get a playlist', async function () {
98     // get empty playlist
99     // get non empty playlist
100   })
101
102   it('Should update a playlist', async function () {
103     // update thumbnail
104
105     // update other details
106   })
107
108   it('Should create a playlist containing different startTimestamp/endTimestamp videos', async function () {
109
110   })
111
112   it('Should correctly list playlist videos', async function () {
113     // empty
114     // some filters?
115   })
116
117   it('Should reorder the playlist', async function () {
118     // reorder 1 element
119     // reorder 3 elements
120     // reorder at the beginning
121     // reorder at the end
122     // reorder before/after
123   })
124
125   it('Should update startTimestamp/endTimestamp of some elements', async function () {
126
127   })
128
129   it('Should delete some elements', async function () {
130
131   })
132
133   it('Should delete the playlist on server 1 and delete on server 2 and 3', async function () {
134
135   })
136
137   it('Should have deleted the thumbnail on server 1, 2 and 3', async function () {
138
139   })
140
141   it('Should unfollow servers 1 and 2 and hide their playlists', async function () {
142
143   })
144
145   it('Should delete a channel and remove the associated playlist', async function () {
146
147   })
148
149   it('Should delete an account and delete its playlists', async function () {
150
151   })
152
153   after(async function () {
154     killallServers(servers)
155
156     // Keep the logs if the test failed
157     if (this['ok']) {
158       await flushTests()
159     }
160   })
161 })