diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-15 10:02:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch) | |
tree | da82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/api/videos/videos-filter.ts | |
parent | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff) | |
download | PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip |
Introduce videos command
Diffstat (limited to 'server/tests/api/videos/videos-filter.ts')
-rw-r--r-- | server/tests/api/videos/videos-filter.ts | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts index 4aa00cfc4..4a5a83ee6 100644 --- a/server/tests/api/videos/videos-filter.ts +++ b/server/tests/api/videos/videos-filter.ts | |||
@@ -1,21 +1,17 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | makeGetRequest, | 10 | makeGetRequest, |
11 | ServerInfo, | 11 | ServerInfo, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers |
13 | uploadVideo | 13 | } from '@shared/extra-utils' |
14 | } from '../../../../shared/extra-utils' | 14 | import { UserRole, Video, VideoPrivacy } from '@shared/models' |
15 | import { UserRole } from '../../../../shared/models/users' | ||
16 | import { Video, VideoPrivacy } from '../../../../shared/models/videos' | ||
17 | |||
18 | const expect = chai.expect | ||
19 | 15 | ||
20 | async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { | 16 | async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { |
21 | const paths = [ | 17 | const paths = [ |
@@ -62,16 +58,16 @@ describe('Test videos filter', function () { | |||
62 | await server.usersCommand.create({ username: moderator.username, password: moderator.password, role: UserRole.MODERATOR }) | 58 | await server.usersCommand.create({ username: moderator.username, password: moderator.password, role: UserRole.MODERATOR }) |
63 | server['moderatorAccessToken'] = await server.loginCommand.getAccessToken(moderator) | 59 | server['moderatorAccessToken'] = await server.loginCommand.getAccessToken(moderator) |
64 | 60 | ||
65 | await uploadVideo(server.url, server.accessToken, { name: 'public ' + server.serverNumber }) | 61 | await server.videosCommand.upload({ attributes: { name: 'public ' + server.serverNumber } }) |
66 | 62 | ||
67 | { | 63 | { |
68 | const attributes = { name: 'unlisted ' + server.serverNumber, privacy: VideoPrivacy.UNLISTED } | 64 | const attributes = { name: 'unlisted ' + server.serverNumber, privacy: VideoPrivacy.UNLISTED } |
69 | await uploadVideo(server.url, server.accessToken, attributes) | 65 | await server.videosCommand.upload({ attributes }) |
70 | } | 66 | } |
71 | 67 | ||
72 | { | 68 | { |
73 | const attributes = { name: 'private ' + server.serverNumber, privacy: VideoPrivacy.PRIVATE } | 69 | const attributes = { name: 'private ' + server.serverNumber, privacy: VideoPrivacy.PRIVATE } |
74 | await uploadVideo(server.url, server.accessToken, attributes) | 70 | await server.videosCommand.upload({ attributes }) |
75 | } | 71 | } |
76 | } | 72 | } |
77 | 73 | ||