projects
/
oweals
/
peertube.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rename blacklist to block/blocklist, merge block and auto-block views
[oweals/peertube.git]
/
server
/
tests
/
api
/
check-params
/
plugins.ts
diff --git
a/server/tests/api/check-params/plugins.ts
b/server/tests/api/check-params/plugins.ts
index 83ce6f4517bf25fdc4439c7aa5981ac7be6b1e34..07ded26eeedeebbd3a03c0ee6575440f5f85ed40 100644
(file)
--- a/
server/tests/api/check-params/plugins.ts
+++ b/
server/tests/api/check-params/plugins.ts
@@
-1,4
+1,4
@@
-/*
tslint:disable:no-unused-expression
*/
+/*
eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await
*/
import 'mocha'
import 'mocha'
@@
-64,6
+64,7
@@
describe('Test server plugins API validators', function () {
describe('With static plugin routes', function () {
it('Should fail with an unknown plugin name/plugin version', async function () {
const paths = [
describe('With static plugin routes', function () {
it('Should fail with an unknown plugin name/plugin version', async function () {
const paths = [
+ '/plugins/' + pluginName + '/0.0.1/auth/fake-auth',
'/plugins/' + pluginName + '/0.0.1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.0.1/client-scripts/client/common-client-plugin.js',
'/themes/' + themeName + '/0.0.1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.0.1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.0.1/client-scripts/client/common-client-plugin.js',
'/themes/' + themeName + '/0.0.1/static/images/chocobo.png',
@@
-86,6
+87,7
@@
describe('Test server plugins API validators', function () {
it('Should fail with invalid versions', async function () {
const paths = [
it('Should fail with invalid versions', async function () {
const paths = [
+ '/plugins/' + pluginName + '/0.0.1.1/auth/fake-auth',
'/plugins/' + pluginName + '/0.0.1.1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.1/client-scripts/client/common-client-plugin.js',
'/themes/' + themeName + '/1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.0.1.1/static/images/chocobo.png',
'/plugins/' + pluginName + '/0.1/client-scripts/client/common-client-plugin.js',
'/themes/' + themeName + '/1/static/images/chocobo.png',
@@
-112,6
+114,12
@@
describe('Test server plugins API validators', function () {
}
})
}
})
+ it('Should fail with an unknown auth name', async function () {
+ const path = '/plugins/' + pluginName + '/' + npmVersion + '/auth/bad-auth'
+
+ await makeGetRequest({ url: server.url, path, statusCodeExpected: 404 })
+ })
+
it('Should fail with an unknown static file', async function () {
const paths = [
'/plugins/' + pluginName + '/' + npmVersion + '/static/fake/chocobo.png',
it('Should fail with an unknown static file', async function () {
const paths = [
'/plugins/' + pluginName + '/' + npmVersion + '/static/fake/chocobo.png',
@@
-145,6
+153,9
@@
describe('Test server plugins API validators', function () {
for (const p of paths) {
await makeGetRequest({ url: server.url, path: p, statusCodeExpected: 200 })
}
for (const p of paths) {
await makeGetRequest({ url: server.url, path: p, statusCodeExpected: 200 })
}
+
+ const authPath = '/plugins/' + pluginName + '/' + npmVersion + '/auth/fake-auth'
+ await makeGetRequest({ url: server.url, path: authPath, statusCodeExpected: 302 })
})
})
})
})
@@
-281,7
+292,7
@@
describe('Test server plugins API validators', function () {
})
})
})
})
- describe('When getting a plugin or the registered settings', function () {
+ describe('When getting a plugin or the registered settings
or public settings
', function () {
const path = '/api/v1/plugins/'
it('Should fail with an invalid token', async function () {
const path = '/api/v1/plugins/'
it('Should fail with an invalid token', async function () {
@@
-307,7
+318,7
@@
describe('Test server plugins API validators', function () {
})
it('Should fail with an invalid npm name', async function () {
})
it('Should fail with an invalid npm name', async function () {
- for (const suffix of [ 'toto', 'toto/registered-settings' ]) {
+ for (const suffix of [ 'toto', 'toto/registered-settings'
, 'toto/public-settings'
]) {
await makeGetRequest({
url: server.url,
path: path + suffix,
await makeGetRequest({
url: server.url,
path: path + suffix,
@@
-316,7
+327,7
@@
describe('Test server plugins API validators', function () {
})
}
})
}
- for (const suffix of [ 'peertube-plugin-TOTO', 'peertube-plugin-TOTO/registered-settings' ]) {
+ for (const suffix of [ 'peertube-plugin-TOTO', 'peertube-plugin-TOTO/registered-settings'
, 'peertube-plugin-TOTO/public-settings'
]) {
await makeGetRequest({
url: server.url,
path: path + suffix,
await makeGetRequest({
url: server.url,
path: path + suffix,
@@
-327,7
+338,7
@@
describe('Test server plugins API validators', function () {
})
it('Should fail with an unknown plugin', async function () {
})
it('Should fail with an unknown plugin', async function () {
- for (const suffix of [ 'peertube-plugin-toto', 'peertube-plugin-toto/registered-settings' ]) {
+ for (const suffix of [ 'peertube-plugin-toto', 'peertube-plugin-toto/registered-settings'
, 'peertube-plugin-toto/public-settings'
]) {
await makeGetRequest({
url: server.url,
path: path + suffix,
await makeGetRequest({
url: server.url,
path: path + suffix,
@@
-338,7
+349,7
@@
describe('Test server plugins API validators', function () {
})
it('Should succeed with the correct parameters', async function () {
})
it('Should succeed with the correct parameters', async function () {
- for (const suffix of [ npmPlugin, `${npmPlugin}/registered-settings` ]) {
+ for (const suffix of [ npmPlugin, `${npmPlugin}/registered-settings`
, `${npmPlugin}/public-settings`
]) {
await makeGetRequest({
url: server.url,
path: path + suffix,
await makeGetRequest({
url: server.url,
path: path + suffix,
@@
-462,6
+473,8
@@
describe('Test server plugins API validators', function () {
})
it('Should succeed with the correct parameters', async function () {
})
it('Should succeed with the correct parameters', async function () {
+ this.timeout(10000)
+
const it = [
{ suffix: 'install', status: 200 },
{ suffix: 'update', status: 200 },
const it = [
{ suffix: 'install', status: 200 },
{ suffix: 'update', status: 200 },