diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-13 09:43:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 6c5065a011b099618681a37bd77eaa7bd3db752e (patch) | |
tree | 352252a00b25013c4b1902f6bcd9668aba295c7b /server/tests/api/check-params/video-imports.ts | |
parent | 0d8ecb7592577f54012413a2b5a9b159cfc90399 (diff) | |
download | PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.gz PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.zst PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.zip |
Introduce server commands
Diffstat (limited to 'server/tests/api/check-params/video-imports.ts')
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index ea473191e..2cc124cc1 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -12,7 +12,6 @@ import { | |||
12 | createUser, | 12 | createUser, |
13 | flushAndRunServer, | 13 | flushAndRunServer, |
14 | getMyUserInformation, | 14 | getMyUserInformation, |
15 | immutableAssign, | ||
16 | ImportsCommand, | 15 | ImportsCommand, |
17 | makeGetRequest, | 16 | makeGetRequest, |
18 | makePostBodyRequest, | 17 | makePostBodyRequest, |
@@ -108,43 +107,43 @@ describe('Test video imports API validator', function () { | |||
108 | }) | 107 | }) |
109 | 108 | ||
110 | it('Should fail with a bad target url', async function () { | 109 | it('Should fail with a bad target url', async function () { |
111 | const fields = immutableAssign(baseCorrectParams, { targetUrl: 'htt://hello' }) | 110 | const fields = { ...baseCorrectParams, targetUrl: 'htt://hello' } |
112 | 111 | ||
113 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 112 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
114 | }) | 113 | }) |
115 | 114 | ||
116 | it('Should fail with a long name', async function () { | 115 | it('Should fail with a long name', async function () { |
117 | const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) }) | 116 | const fields = { ...baseCorrectParams, name: 'super'.repeat(65) } |
118 | 117 | ||
119 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 118 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
120 | }) | 119 | }) |
121 | 120 | ||
122 | it('Should fail with a bad category', async function () { | 121 | it('Should fail with a bad category', async function () { |
123 | const fields = immutableAssign(baseCorrectParams, { category: 125 }) | 122 | const fields = { ...baseCorrectParams, category: 125 } |
124 | 123 | ||
125 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 124 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
126 | }) | 125 | }) |
127 | 126 | ||
128 | it('Should fail with a bad licence', async function () { | 127 | it('Should fail with a bad licence', async function () { |
129 | const fields = immutableAssign(baseCorrectParams, { licence: 125 }) | 128 | const fields = { ...baseCorrectParams, licence: 125 } |
130 | 129 | ||
131 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 130 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
132 | }) | 131 | }) |
133 | 132 | ||
134 | it('Should fail with a bad language', async function () { | 133 | it('Should fail with a bad language', async function () { |
135 | const fields = immutableAssign(baseCorrectParams, { language: 'a'.repeat(15) }) | 134 | const fields = { ...baseCorrectParams, language: 'a'.repeat(15) } |
136 | 135 | ||
137 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 136 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
138 | }) | 137 | }) |
139 | 138 | ||
140 | it('Should fail with a long description', async function () { | 139 | it('Should fail with a long description', async function () { |
141 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(2500) }) | 140 | const fields = { ...baseCorrectParams, description: 'super'.repeat(2500) } |
142 | 141 | ||
143 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 142 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
144 | }) | 143 | }) |
145 | 144 | ||
146 | it('Should fail with a long support text', async function () { | 145 | it('Should fail with a long support text', async function () { |
147 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) }) | 146 | const fields = { ...baseCorrectParams, support: 'super'.repeat(201) } |
148 | 147 | ||
149 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 148 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
150 | }) | 149 | }) |
@@ -156,7 +155,7 @@ describe('Test video imports API validator', function () { | |||
156 | }) | 155 | }) |
157 | 156 | ||
158 | it('Should fail with a bad channel', async function () { | 157 | it('Should fail with a bad channel', async function () { |
159 | const fields = immutableAssign(baseCorrectParams, { channelId: 545454 }) | 158 | const fields = { ...baseCorrectParams, channelId: 545454 } |
160 | 159 | ||
161 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 160 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
162 | }) | 161 | }) |
@@ -172,25 +171,25 @@ describe('Test video imports API validator', function () { | |||
172 | const res = await getMyUserInformation(server.url, accessTokenUser) | 171 | const res = await getMyUserInformation(server.url, accessTokenUser) |
173 | const customChannelId = res.body.videoChannels[0].id | 172 | const customChannelId = res.body.videoChannels[0].id |
174 | 173 | ||
175 | const fields = immutableAssign(baseCorrectParams, { channelId: customChannelId }) | 174 | const fields = { ...baseCorrectParams, channelId: customChannelId } |
176 | 175 | ||
177 | await makePostBodyRequest({ url: server.url, path, token: userAccessToken, fields }) | 176 | await makePostBodyRequest({ url: server.url, path, token: userAccessToken, fields }) |
178 | }) | 177 | }) |
179 | 178 | ||
180 | it('Should fail with too many tags', async function () { | 179 | it('Should fail with too many tags', async function () { |
181 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] }) | 180 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] } |
182 | 181 | ||
183 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 182 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
184 | }) | 183 | }) |
185 | 184 | ||
186 | it('Should fail with a tag length too low', async function () { | 185 | it('Should fail with a tag length too low', async function () { |
187 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] }) | 186 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 't' ] } |
188 | 187 | ||
189 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 188 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
190 | }) | 189 | }) |
191 | 190 | ||
192 | it('Should fail with a tag length too big', async function () { | 191 | it('Should fail with a tag length too big', async function () { |
193 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] }) | 192 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] } |
194 | 193 | ||
195 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 194 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
196 | }) | 195 | }) |
@@ -242,7 +241,7 @@ describe('Test video imports API validator', function () { | |||
242 | 241 | ||
243 | it('Should fail with an invalid magnet URI', async function () { | 242 | it('Should fail with an invalid magnet URI', async function () { |
244 | let fields = omit(baseCorrectParams, 'targetUrl') | 243 | let fields = omit(baseCorrectParams, 'targetUrl') |
245 | fields = immutableAssign(fields, { magnetUri: 'blabla' }) | 244 | fields = { ...fields, magnetUri: 'blabla' } |
246 | 245 | ||
247 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 246 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
248 | }) | 247 | }) |
@@ -301,7 +300,7 @@ describe('Test video imports API validator', function () { | |||
301 | }) | 300 | }) |
302 | 301 | ||
303 | let fields = omit(baseCorrectParams, 'targetUrl') | 302 | let fields = omit(baseCorrectParams, 'targetUrl') |
304 | fields = immutableAssign(fields, { magnetUri: ImportsCommand.getMagnetURI() }) | 303 | fields = { ...fields, magnetUri: ImportsCommand.getMagnetURI() } |
305 | 304 | ||
306 | await makePostBodyRequest({ | 305 | await makePostBodyRequest({ |
307 | url: server.url, | 306 | url: server.url, |