diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-13 14:23:01 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch) | |
tree | 7a166515e4d57a06eb3c08be569f106ed049988b /server/tests/api/check-params/videos.ts | |
parent | d0a0fa429d4651710ed951a3c11af0219e408964 (diff) | |
download | PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip |
Introduce user command
Diffstat (limited to 'server/tests/api/check-params/videos.ts')
-rw-r--r-- | server/tests/api/check-params/videos.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 8e11232bd..855b09f39 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -10,9 +10,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
10 | import { | 10 | import { |
11 | checkUploadVideoParam, | 11 | checkUploadVideoParam, |
12 | cleanupTests, | 12 | cleanupTests, |
13 | createUser, | ||
14 | flushAndRunServer, | 13 | flushAndRunServer, |
15 | getMyUserInformation, | ||
16 | getVideo, | 14 | getVideo, |
17 | getVideosList, | 15 | getVideosList, |
18 | makeDeleteRequest, | 16 | makeDeleteRequest, |
@@ -53,14 +51,14 @@ describe('Test videos API validator', function () { | |||
53 | 51 | ||
54 | const username = 'user1' | 52 | const username = 'user1' |
55 | const password = 'my super password' | 53 | const password = 'my super password' |
56 | await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) | 54 | await server.usersCommand.create({ username: username, password: password }) |
57 | userAccessToken = await server.loginCommand.getAccessToken({ username, password }) | 55 | userAccessToken = await server.loginCommand.getAccessToken({ username, password }) |
58 | 56 | ||
59 | { | 57 | { |
60 | const res = await getMyUserInformation(server.url, server.accessToken) | 58 | const body = await server.usersCommand.getMyInfo() |
61 | channelId = res.body.videoChannels[0].id | 59 | channelId = body.videoChannels[0].id |
62 | channelName = res.body.videoChannels[0].name | 60 | channelName = body.videoChannels[0].name |
63 | accountName = res.body.account.name + '@' + res.body.account.host | 61 | accountName = body.account.name + '@' + body.account.host |
64 | } | 62 | } |
65 | }) | 63 | }) |
66 | 64 | ||
@@ -283,11 +281,11 @@ describe('Test videos API validator', function () { | |||
283 | username: 'fake' + randomInt(0, 1500), | 281 | username: 'fake' + randomInt(0, 1500), |
284 | password: 'fake_password' | 282 | password: 'fake_password' |
285 | } | 283 | } |
286 | await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) | 284 | await server.usersCommand.create({ username: user.username, password: user.password }) |
287 | 285 | ||
288 | const accessTokenUser = await server.loginCommand.getAccessToken(user) | 286 | const accessTokenUser = await server.loginCommand.getAccessToken(user) |
289 | const res = await getMyUserInformation(server.url, accessTokenUser) | 287 | const { videoChannels } = await server.usersCommand.getMyInfo({ token: accessTokenUser }) |
290 | const customChannelId = res.body.videoChannels[0].id | 288 | const customChannelId = videoChannels[0].id |
291 | 289 | ||
292 | const fields = { ...baseCorrectParams, channelId: customChannelId } | 290 | const fields = { ...baseCorrectParams, channelId: customChannelId } |
293 | const attaches = baseCorrectAttaches | 291 | const attaches = baseCorrectAttaches |