aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-playlists.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-playlists.ts')
-rw-r--r--server/tests/api/videos/video-playlists.ts34
1 files changed, 6 insertions, 28 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 38133e2ce..e57d86c14 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -6,13 +6,9 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 checkPlaylistFilesWereRemoved, 7 checkPlaylistFilesWereRemoved,
8 cleanupTests, 8 cleanupTests,
9 createUser,
10 doubleFollow, 9 doubleFollow,
11 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
12 generateUserAccessToken,
13 getMyUserInformation,
14 PlaylistsCommand, 11 PlaylistsCommand,
15 removeUser,
16 ServerInfo, 12 ServerInfo,
17 setAccessTokensToServers, 13 setAccessTokensToServers,
18 setDefaultVideoChannel, 14 setDefaultVideoChannel,
@@ -24,7 +20,6 @@ import {
24 waitJobs 20 waitJobs
25} from '@shared/extra-utils' 21} from '@shared/extra-utils'
26import { 22import {
27 User,
28 VideoPlaylist, 23 VideoPlaylist,
29 VideoPlaylistCreateResult, 24 VideoPlaylistCreateResult,
30 VideoPlaylistElementType, 25 VideoPlaylistElementType,
@@ -113,15 +108,7 @@ describe('Test video playlists', function () {
113 108
114 nsfwVideoServer1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'NSFW video', nsfw: true })).id 109 nsfwVideoServer1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'NSFW video', nsfw: true })).id
115 110
116 { 111 userTokenServer1 = await servers[0].usersCommand.generateUserAndToken('user1')
117 await createUser({
118 url: servers[0].url,
119 accessToken: servers[0].accessToken,
120 username: 'user1',
121 password: 'password'
122 })
123 userTokenServer1 = await servers[0].loginCommand.getAccessToken('user1', 'password')
124 }
125 112
126 await waitJobs(servers) 113 await waitJobs(servers)
127 }) 114 })
@@ -165,7 +152,7 @@ describe('Test video playlists', function () {
165 }) 152 })
166 153
167 it('Should get private playlist for a classic user', async function () { 154 it('Should get private playlist for a classic user', async function () {
168 const token = await generateUserAccessToken(servers[0], 'toto') 155 const token = await servers[0].usersCommand.generateUserAndToken('toto')
169 156
170 const body = await commands[0].listByAccount({ token, handle: 'toto' }) 157 const body = await commands[0].listByAccount({ token, handle: 'toto' })
171 158
@@ -1118,19 +1105,10 @@ describe('Test video playlists', function () {
1118 it('Should delete an account and delete its playlists', async function () { 1105 it('Should delete an account and delete its playlists', async function () {
1119 this.timeout(30000) 1106 this.timeout(30000)
1120 1107
1121 const user = { username: 'user_1', password: 'password' } 1108 const { userId, token } = await servers[0].usersCommand.generate('user_1')
1122 const res = await createUser({
1123 url: servers[0].url,
1124 accessToken: servers[0].accessToken,
1125 username: user.username,
1126 password: user.password
1127 })
1128
1129 const userId = res.body.user.id
1130 const userAccessToken = await servers[0].loginCommand.getAccessToken(user)
1131 1109
1132 const resChannel = await getMyUserInformation(servers[0].url, userAccessToken) 1110 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token })
1133 const userChannel = (resChannel.body as User).videoChannels[0] 1111 const userChannel = videoChannels[0]
1134 1112
1135 await commands[0].create({ 1113 await commands[0].create({
1136 attributes: { 1114 attributes: {
@@ -1152,7 +1130,7 @@ describe('Test video playlists', function () {
1152 } 1130 }
1153 } 1131 }
1154 1132
1155 await removeUser(servers[0].url, userId, servers[0].accessToken) 1133 await servers[0].usersCommand.remove({ userId })
1156 await waitJobs(servers) 1134 await waitJobs(servers)
1157 1135
1158 { 1136 {