diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-10 16:00:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-10 16:01:59 +0200 |
commit | 0cfc8c4fe4f44ef98b7be3683dae76da8236e641 (patch) | |
tree | 112c0a5d4b6a07aeab2b8734e94eba155cb5d66c /server | |
parent | e67ecaf8497797fa312f170d03065b14dd6576a8 (diff) | |
download | PeerTube-0cfc8c4fe4f44ef98b7be3683dae76da8236e641.tar.gz PeerTube-0cfc8c4fe4f44ef98b7be3683dae76da8236e641.tar.zst PeerTube-0cfc8c4fe4f44ef98b7be3683dae76da8236e641.zip |
Fix test
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/api/check-params/channel-import-videos.ts | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/server/tests/api/check-params/channel-import-videos.ts b/server/tests/api/check-params/channel-import-videos.ts index 90d61f20a..14587c376 100644 --- a/server/tests/api/check-params/channel-import-videos.ts +++ b/server/tests/api/check-params/channel-import-videos.ts | |||
@@ -4,7 +4,14 @@ import 'mocha' | |||
4 | import { FIXTURE_URLS } from '@server/tests/shared' | 4 | import { FIXTURE_URLS } from '@server/tests/shared' |
5 | import { areHttpImportTestsDisabled } from '@shared/core-utils' | 5 | import { areHttpImportTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode } from '@shared/models' |
7 | import { ChannelsCommand, cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 7 | import { |
8 | ChannelsCommand, | ||
9 | cleanupTests, | ||
10 | createSingleServer, | ||
11 | PeerTubeServer, | ||
12 | setAccessTokensToServers, | ||
13 | setDefaultVideoChannel | ||
14 | } from '@shared/server-commands' | ||
8 | 15 | ||
9 | describe('Test videos import in a channel API validator', function () { | 16 | describe('Test videos import in a channel API validator', function () { |
10 | let server: PeerTubeServer | 17 | let server: PeerTubeServer |
@@ -25,6 +32,7 @@ describe('Test videos import in a channel API validator', function () { | |||
25 | server = await createSingleServer(1) | 32 | server = await createSingleServer(1) |
26 | 33 | ||
27 | await setAccessTokensToServers([ server ]) | 34 | await setAccessTokensToServers([ server ]) |
35 | await setDefaultVideoChannel([ server ]) | ||
28 | 36 | ||
29 | const userCreds = { | 37 | const userCreds = { |
30 | username: 'fake', | 38 | username: 'fake', |
@@ -44,7 +52,7 @@ describe('Test videos import in a channel API validator', function () { | |||
44 | await server.config.disableImports() | 52 | await server.config.disableImports() |
45 | 53 | ||
46 | await command.importVideos({ | 54 | await command.importVideos({ |
47 | channelName: 'super_channel', | 55 | channelName: server.store.channel.name, |
48 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, | 56 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, |
49 | token: server.accessToken, | 57 | token: server.accessToken, |
50 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 58 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
@@ -55,7 +63,7 @@ describe('Test videos import in a channel API validator', function () { | |||
55 | 63 | ||
56 | it('Should fail when externalChannelUrl is not provided', async function () { | 64 | it('Should fail when externalChannelUrl is not provided', async function () { |
57 | await command.importVideos({ | 65 | await command.importVideos({ |
58 | channelName: 'super_channel', | 66 | channelName: server.store.channel.name, |
59 | externalChannelUrl: null, | 67 | externalChannelUrl: null, |
60 | token: server.accessToken, | 68 | token: server.accessToken, |
61 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 69 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
@@ -64,7 +72,7 @@ describe('Test videos import in a channel API validator', function () { | |||
64 | 72 | ||
65 | it('Should fail when externalChannelUrl is malformed', async function () { | 73 | it('Should fail when externalChannelUrl is malformed', async function () { |
66 | await command.importVideos({ | 74 | await command.importVideos({ |
67 | channelName: 'super_channel', | 75 | channelName: server.store.channel.name, |
68 | externalChannelUrl: 'not-a-url', | 76 | externalChannelUrl: 'not-a-url', |
69 | token: server.accessToken, | 77 | token: server.accessToken, |
70 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 78 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
@@ -73,7 +81,7 @@ describe('Test videos import in a channel API validator', function () { | |||
73 | 81 | ||
74 | it('Should fail with a bad sync id', async function () { | 82 | it('Should fail with a bad sync id', async function () { |
75 | await command.importVideos({ | 83 | await command.importVideos({ |
76 | channelName: 'super_channel', | 84 | channelName: server.store.channel.name, |
77 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, | 85 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, |
78 | videoChannelSyncId: 'toto' as any, | 86 | videoChannelSyncId: 'toto' as any, |
79 | token: server.accessToken, | 87 | token: server.accessToken, |
@@ -83,7 +91,7 @@ describe('Test videos import in a channel API validator', function () { | |||
83 | 91 | ||
84 | it('Should fail with a unknown sync id', async function () { | 92 | it('Should fail with a unknown sync id', async function () { |
85 | await command.importVideos({ | 93 | await command.importVideos({ |
86 | channelName: 'super_channel', | 94 | channelName: server.store.channel.name, |
87 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, | 95 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, |
88 | videoChannelSyncId: 42, | 96 | videoChannelSyncId: 42, |
89 | token: server.accessToken, | 97 | token: server.accessToken, |
@@ -93,7 +101,7 @@ describe('Test videos import in a channel API validator', function () { | |||
93 | 101 | ||
94 | it('Should fail with no authentication', async function () { | 102 | it('Should fail with no authentication', async function () { |
95 | await command.importVideos({ | 103 | await command.importVideos({ |
96 | channelName: 'super_channel', | 104 | channelName: server.store.channel.name, |
97 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, | 105 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, |
98 | token: null, | 106 | token: null, |
99 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 107 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
@@ -102,7 +110,7 @@ describe('Test videos import in a channel API validator', function () { | |||
102 | 110 | ||
103 | it('Should fail when sync is not owned by the user', async function () { | 111 | it('Should fail when sync is not owned by the user', async function () { |
104 | await command.importVideos({ | 112 | await command.importVideos({ |
105 | channelName: 'super_channel', | 113 | channelName: server.store.channel.name, |
106 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, | 114 | externalChannelUrl: FIXTURE_URLS.youtubeChannel, |
107 | token: userInfo.accessToken, | 115 | token: userInfo.accessToken, |
108 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 116 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |