diff options
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r-- | server/tests/client.ts | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts index 96403da37..e91d4c671 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -9,13 +9,11 @@ import { | |||
9 | cleanupTests, | 9 | cleanupTests, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
12 | getVideosList, | ||
13 | makeGetRequest, | 12 | makeGetRequest, |
14 | makeHTMLRequest, | 13 | makeHTMLRequest, |
15 | ServerInfo, | 14 | ServerInfo, |
16 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
18 | uploadVideo, | ||
19 | waitJobs | 17 | waitJobs |
20 | } from '../../shared/extra-utils' | 18 | } from '../../shared/extra-utils' |
21 | 19 | ||
@@ -68,36 +66,41 @@ describe('Test a client controllers', function () { | |||
68 | 66 | ||
69 | // Video | 67 | // Video |
70 | 68 | ||
71 | const videoAttributes = { name: videoName, description: videoDescription } | 69 | { |
72 | await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) | 70 | const attributes = { name: videoName, description: videoDescription } |
71 | await servers[0].videosCommand.upload({ attributes }) | ||
73 | 72 | ||
74 | const resVideosRequest = await getVideosList(servers[0].url) | 73 | const { data } = await servers[0].videosCommand.list() |
75 | const videos = resVideosRequest.body.data | 74 | expect(data.length).to.equal(1) |
76 | expect(videos.length).to.equal(1) | ||
77 | 75 | ||
78 | const video = videos[0] | 76 | const video = data[0] |
79 | servers[0].video = video | 77 | servers[0].video = video |
80 | videoIds = [ video.id, video.uuid, video.shortUUID ] | 78 | videoIds = [ video.id, video.uuid, video.shortUUID ] |
79 | } | ||
81 | 80 | ||
82 | // Playlist | 81 | // Playlist |
83 | 82 | ||
84 | const attributes = { | 83 | { |
85 | displayName: playlistName, | 84 | const attributes = { |
86 | description: playlistDescription, | 85 | displayName: playlistName, |
87 | privacy: VideoPlaylistPrivacy.PUBLIC, | 86 | description: playlistDescription, |
88 | videoChannelId: servers[0].videoChannel.id | 87 | privacy: VideoPlaylistPrivacy.PUBLIC, |
89 | } | 88 | videoChannelId: servers[0].videoChannel.id |
89 | } | ||
90 | 90 | ||
91 | playlist = await servers[0].playlistsCommand.create({ attributes }) | 91 | playlist = await servers[0].playlistsCommand.create({ attributes }) |
92 | playlistIds = [ playlist.id, playlist.shortUUID, playlist.uuid ] | 92 | playlistIds = [ playlist.id, playlist.shortUUID, playlist.uuid ] |
93 | 93 | ||
94 | await servers[0].playlistsCommand.addElement({ playlistId: playlist.shortUUID, attributes: { videoId: video.id } }) | 94 | await servers[0].playlistsCommand.addElement({ playlistId: playlist.shortUUID, attributes: { videoId: servers[0].video.id } }) |
95 | } | ||
95 | 96 | ||
96 | // Account | 97 | // Account |
97 | 98 | ||
98 | await servers[0].usersCommand.updateMe({ description: 'my account description' }) | 99 | { |
100 | await servers[0].usersCommand.updateMe({ description: 'my account description' }) | ||
99 | 101 | ||
100 | account = await servers[0].accountsCommand.get({ accountName: `${servers[0].user.username}@${servers[0].host}` }) | 102 | account = await servers[0].accountsCommand.get({ accountName: `${servers[0].user.username}@${servers[0].host}` }) |
103 | } | ||
101 | 104 | ||
102 | await waitJobs(servers) | 105 | await waitJobs(servers) |
103 | }) | 106 | }) |