diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 10:42:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch) | |
tree | baf29753ac5d4598643e3bee719f8df0cc36c59d /server/tests/api/videos/video-nsfw.ts | |
parent | 08642a765ea514a00f159db898edf14c376fbe6c (diff) | |
download | PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip |
Refactor requests
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r-- | server/tests/api/videos/video-nsfw.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index b25dcda20..0a9e5ce3f 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -19,8 +19,10 @@ describe('Test video NSFW policy', function () { | |||
19 | 19 | ||
20 | async function getVideosFunctions (token?: string, query: { nsfw?: BooleanBothQuery } = {}) { | 20 | async function getVideosFunctions (token?: string, query: { nsfw?: BooleanBothQuery } = {}) { |
21 | const user = await server.users.getMyInfo() | 21 | const user = await server.users.getMyInfo() |
22 | const videoChannelName = user.videoChannels[0].name | 22 | |
23 | const channelName = user.videoChannels[0].name | ||
23 | const accountName = user.account.name + '@' + user.account.host | 24 | const accountName = user.account.name + '@' + user.account.host |
25 | |||
24 | const hasQuery = Object.keys(query).length !== 0 | 26 | const hasQuery = Object.keys(query).length !== 0 |
25 | let promises: Promise<ResultList<Video>>[] | 27 | let promises: Promise<ResultList<Video>>[] |
26 | 28 | ||
@@ -28,8 +30,8 @@ describe('Test video NSFW policy', function () { | |||
28 | promises = [ | 30 | promises = [ |
29 | server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), | 31 | server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), |
30 | server.videos.listWithToken({ token, ...query }), | 32 | server.videos.listWithToken({ token, ...query }), |
31 | server.videos.listByAccount({ token, accountName, ...query }), | 33 | server.videos.listByAccount({ token, handle: channelName, ...query }), |
32 | server.videos.listByChannel({ token, videoChannelName, ...query }) | 34 | server.videos.listByChannel({ token, handle: accountName, ...query }) |
33 | ] | 35 | ] |
34 | 36 | ||
35 | // Overviews do not support video filters | 37 | // Overviews do not support video filters |
@@ -45,8 +47,8 @@ describe('Test video NSFW policy', function () { | |||
45 | promises = [ | 47 | promises = [ |
46 | server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), | 48 | server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), |
47 | server.videos.list(), | 49 | server.videos.list(), |
48 | server.videos.listByAccount({ accountName }), | 50 | server.videos.listByAccount({ handle: channelName }), |
49 | server.videos.listByChannel({ videoChannelName }) | 51 | server.videos.listByChannel({ handle: accountName }) |
50 | ] | 52 | ] |
51 | 53 | ||
52 | // Overviews do not support video filters | 54 | // Overviews do not support video filters |