diff options
Diffstat (limited to 'server/tests/fixtures')
19 files changed, 661 insertions, 1 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js b/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js new file mode 100644 index 000000000..c65b8d3a8 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js | |||
@@ -0,0 +1,75 @@ | |||
1 | async function register ({ | ||
2 | registerExternalAuth, | ||
3 | peertubeHelpers, | ||
4 | settingsManager, | ||
5 | unregisterExternalAuth | ||
6 | }) { | ||
7 | { | ||
8 | const result = registerExternalAuth({ | ||
9 | authName: 'external-auth-1', | ||
10 | authDisplayName: () => 'External Auth 1', | ||
11 | onLogout: user => peertubeHelpers.logger.info('On logout %s', user.username), | ||
12 | onAuthRequest: (req, res) => { | ||
13 | const username = req.query.username | ||
14 | |||
15 | result.userAuthenticated({ | ||
16 | req, | ||
17 | res, | ||
18 | username, | ||
19 | email: username + '@example.com' | ||
20 | }) | ||
21 | } | ||
22 | }) | ||
23 | } | ||
24 | |||
25 | { | ||
26 | const result = registerExternalAuth({ | ||
27 | authName: 'external-auth-2', | ||
28 | authDisplayName: () => 'External Auth 2', | ||
29 | onAuthRequest: (req, res) => { | ||
30 | result.userAuthenticated({ | ||
31 | req, | ||
32 | res, | ||
33 | username: 'kefka', | ||
34 | email: 'kefka@example.com', | ||
35 | role: 0, | ||
36 | displayName: 'Kefka Palazzo' | ||
37 | }) | ||
38 | }, | ||
39 | hookTokenValidity: (options) => { | ||
40 | if (options.type === 'refresh') { | ||
41 | return { valid: false } | ||
42 | } | ||
43 | |||
44 | if (options.type === 'access') { | ||
45 | const token = options.token | ||
46 | const now = new Date() | ||
47 | now.setTime(now.getTime() - 5000) | ||
48 | |||
49 | const createdAt = new Date(token.createdAt) | ||
50 | |||
51 | return { valid: createdAt.getTime() >= now.getTime() } | ||
52 | } | ||
53 | |||
54 | return { valid: true } | ||
55 | } | ||
56 | }) | ||
57 | } | ||
58 | |||
59 | settingsManager.onSettingsChange(settings => { | ||
60 | if (settings.disableKefka) { | ||
61 | unregisterExternalAuth('external-auth-2') | ||
62 | } | ||
63 | }) | ||
64 | } | ||
65 | |||
66 | async function unregister () { | ||
67 | return | ||
68 | } | ||
69 | |||
70 | module.exports = { | ||
71 | register, | ||
72 | unregister | ||
73 | } | ||
74 | |||
75 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-one/package.json b/server/tests/fixtures/peertube-plugin-test-external-auth-one/package.json new file mode 100644 index 000000000..22814b047 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-one/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-external-auth-one", | ||
3 | "version": "0.0.1", | ||
4 | "description": "External auth one", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-two/main.js b/server/tests/fixtures/peertube-plugin-test-external-auth-two/main.js new file mode 100644 index 000000000..126905ffc --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-two/main.js | |||
@@ -0,0 +1,31 @@ | |||
1 | async function register ({ | ||
2 | registerExternalAuth, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | { | ||
6 | const result = registerExternalAuth({ | ||
7 | authName: 'external-auth-3', | ||
8 | authDisplayName: () => 'External Auth 3', | ||
9 | onAuthRequest: (req, res) => { | ||
10 | result.userAuthenticated({ | ||
11 | req, | ||
12 | res, | ||
13 | username: 'cid', | ||
14 | email: 'cid@example.com', | ||
15 | displayName: 'Cid Marquez' | ||
16 | }) | ||
17 | } | ||
18 | }) | ||
19 | } | ||
20 | } | ||
21 | |||
22 | async function unregister () { | ||
23 | return | ||
24 | } | ||
25 | |||
26 | module.exports = { | ||
27 | register, | ||
28 | unregister | ||
29 | } | ||
30 | |||
31 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-two/package.json b/server/tests/fixtures/peertube-plugin-test-external-auth-two/package.json new file mode 100644 index 000000000..a5ca4d07a --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-two/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-external-auth-two", | ||
3 | "version": "0.0.1", | ||
4 | "description": "External auth two", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-five/main.js b/server/tests/fixtures/peertube-plugin-test-five/main.js new file mode 100644 index 000000000..c1435b928 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-five/main.js | |||
@@ -0,0 +1,21 @@ | |||
1 | async function register ({ | ||
2 | getRouter | ||
3 | }) { | ||
4 | const router = getRouter() | ||
5 | router.get('/ping', (req, res) => res.json({ message: 'pong' })) | ||
6 | |||
7 | router.post('/form/post/mirror', (req, res) => { | ||
8 | res.json(req.body) | ||
9 | }) | ||
10 | } | ||
11 | |||
12 | async function unregister () { | ||
13 | return | ||
14 | } | ||
15 | |||
16 | module.exports = { | ||
17 | register, | ||
18 | unregister | ||
19 | } | ||
20 | |||
21 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-five/package.json b/server/tests/fixtures/peertube-plugin-test-five/package.json new file mode 100644 index 000000000..1f5d65d9d --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-five/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-five", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Plugin test 5", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js new file mode 100644 index 000000000..067c3fe15 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-four/main.js | |||
@@ -0,0 +1,114 @@ | |||
1 | async function register ({ | ||
2 | peertubeHelpers, | ||
3 | registerHook, | ||
4 | getRouter | ||
5 | }) { | ||
6 | const logger = peertubeHelpers.logger | ||
7 | |||
8 | logger.info('Hello world from plugin four') | ||
9 | |||
10 | { | ||
11 | const username = 'root' | ||
12 | const results = await peertubeHelpers.database.query( | ||
13 | 'SELECT "email" from "user" WHERE "username" = $username', | ||
14 | { | ||
15 | type: 'SELECT', | ||
16 | bind: { username } | ||
17 | } | ||
18 | ) | ||
19 | |||
20 | logger.info('root email is ' + results[0]['email']) | ||
21 | } | ||
22 | |||
23 | { | ||
24 | registerHook({ | ||
25 | target: 'action:api.video.viewed', | ||
26 | handler: async ({ video }) => { | ||
27 | const videoFromDB = await peertubeHelpers.videos.loadByUrl(video.url) | ||
28 | logger.info('video from DB uuid is %s.', videoFromDB.uuid) | ||
29 | |||
30 | await peertubeHelpers.videos.removeVideo(video.id) | ||
31 | |||
32 | logger.info('Video deleted by plugin four.') | ||
33 | } | ||
34 | }) | ||
35 | } | ||
36 | |||
37 | { | ||
38 | const serverActor = await peertubeHelpers.server.getServerActor() | ||
39 | logger.info('server actor name is %s', serverActor.preferredUsername) | ||
40 | } | ||
41 | |||
42 | { | ||
43 | logger.info('server url is %s', peertubeHelpers.config.getWebserverUrl()) | ||
44 | } | ||
45 | |||
46 | { | ||
47 | const actions = { | ||
48 | blockServer, | ||
49 | unblockServer, | ||
50 | blockAccount, | ||
51 | unblockAccount, | ||
52 | blacklist, | ||
53 | unblacklist | ||
54 | } | ||
55 | |||
56 | const router = getRouter() | ||
57 | router.post('/commander', async (req, res) => { | ||
58 | try { | ||
59 | await actions[req.body.command](peertubeHelpers, req.body) | ||
60 | |||
61 | res.sendStatus(204) | ||
62 | } catch (err) { | ||
63 | logger.error('Error in commander.', { err }) | ||
64 | res.sendStatus(500) | ||
65 | } | ||
66 | }) | ||
67 | } | ||
68 | } | ||
69 | |||
70 | async function unregister () { | ||
71 | return | ||
72 | } | ||
73 | |||
74 | module.exports = { | ||
75 | register, | ||
76 | unregister | ||
77 | } | ||
78 | |||
79 | // ########################################################################### | ||
80 | |||
81 | async function blockServer (peertubeHelpers, body) { | ||
82 | const serverActor = await peertubeHelpers.server.getServerActor() | ||
83 | |||
84 | await peertubeHelpers.moderation.blockServer({ byAccountId: serverActor.Account.id, hostToBlock: body.hostToBlock }) | ||
85 | } | ||
86 | |||
87 | async function unblockServer (peertubeHelpers, body) { | ||
88 | const serverActor = await peertubeHelpers.server.getServerActor() | ||
89 | |||
90 | await peertubeHelpers.moderation.unblockServer({ byAccountId: serverActor.Account.id, hostToUnblock: body.hostToUnblock }) | ||
91 | } | ||
92 | |||
93 | async function blockAccount (peertubeHelpers, body) { | ||
94 | const serverActor = await peertubeHelpers.server.getServerActor() | ||
95 | |||
96 | await peertubeHelpers.moderation.blockAccount({ byAccountId: serverActor.Account.id, handleToBlock: body.handleToBlock }) | ||
97 | } | ||
98 | |||
99 | async function unblockAccount (peertubeHelpers, body) { | ||
100 | const serverActor = await peertubeHelpers.server.getServerActor() | ||
101 | |||
102 | await peertubeHelpers.moderation.unblockAccount({ byAccountId: serverActor.Account.id, handleToUnblock: body.handleToUnblock }) | ||
103 | } | ||
104 | |||
105 | async function blacklist (peertubeHelpers, body) { | ||
106 | await peertubeHelpers.moderation.blacklistVideo({ | ||
107 | videoIdOrUUID: body.videoUUID, | ||
108 | createOptions: body | ||
109 | }) | ||
110 | } | ||
111 | |||
112 | async function unblacklist (peertubeHelpers, body) { | ||
113 | await peertubeHelpers.moderation.unblacklistVideo({ videoIdOrUUID: body.videoUUID }) | ||
114 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-four/package.json b/server/tests/fixtures/peertube-plugin-test-four/package.json new file mode 100644 index 000000000..dda3c7f37 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-four/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-four", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Plugin test 4", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.js b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.js new file mode 100644 index 000000000..f58faa847 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.js | |||
@@ -0,0 +1,69 @@ | |||
1 | async function register ({ | ||
2 | registerIdAndPassAuth, | ||
3 | peertubeHelpers, | ||
4 | settingsManager, | ||
5 | unregisterIdAndPassAuth | ||
6 | }) { | ||
7 | registerIdAndPassAuth({ | ||
8 | authName: 'spyro-auth', | ||
9 | |||
10 | onLogout: () => { | ||
11 | peertubeHelpers.logger.info('On logout for auth 1 - 1') | ||
12 | }, | ||
13 | |||
14 | getWeight: () => 15, | ||
15 | |||
16 | login (body) { | ||
17 | if (body.id === 'spyro' && body.password === 'spyro password') { | ||
18 | return Promise.resolve({ | ||
19 | username: 'spyro', | ||
20 | email: 'spyro@example.com', | ||
21 | role: 2, | ||
22 | displayName: 'Spyro the Dragon' | ||
23 | }) | ||
24 | } | ||
25 | |||
26 | return null | ||
27 | } | ||
28 | }) | ||
29 | |||
30 | registerIdAndPassAuth({ | ||
31 | authName: 'crash-auth', | ||
32 | |||
33 | onLogout: () => { | ||
34 | peertubeHelpers.logger.info('On logout for auth 1 - 2') | ||
35 | }, | ||
36 | |||
37 | getWeight: () => 50, | ||
38 | |||
39 | login (body) { | ||
40 | if (body.id === 'crash' && body.password === 'crash password') { | ||
41 | return Promise.resolve({ | ||
42 | username: 'crash', | ||
43 | email: 'crash@example.com', | ||
44 | role: 1, | ||
45 | displayName: 'Crash Bandicoot' | ||
46 | }) | ||
47 | } | ||
48 | |||
49 | return null | ||
50 | } | ||
51 | }) | ||
52 | |||
53 | settingsManager.onSettingsChange(settings => { | ||
54 | if (settings.disableSpyro) { | ||
55 | unregisterIdAndPassAuth('spyro-auth') | ||
56 | } | ||
57 | }) | ||
58 | } | ||
59 | |||
60 | async function unregister () { | ||
61 | return | ||
62 | } | ||
63 | |||
64 | module.exports = { | ||
65 | register, | ||
66 | unregister | ||
67 | } | ||
68 | |||
69 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.json b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.json new file mode 100644 index 000000000..f8ad18a90 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-id-pass-auth-one", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Id and pass auth one", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.js b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.js new file mode 100644 index 000000000..caa6a7ccd --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.js | |||
@@ -0,0 +1,106 @@ | |||
1 | async function register ({ | ||
2 | registerIdAndPassAuth, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | registerIdAndPassAuth({ | ||
6 | authName: 'laguna-bad-auth', | ||
7 | |||
8 | onLogout: () => { | ||
9 | peertubeHelpers.logger.info('On logout for auth 3 - 1') | ||
10 | }, | ||
11 | |||
12 | getWeight: () => 5, | ||
13 | |||
14 | login (body) { | ||
15 | if (body.id === 'laguna' && body.password === 'laguna password') { | ||
16 | return Promise.resolve({ | ||
17 | username: 'laguna', | ||
18 | email: 'laguna@example.com', | ||
19 | displayName: 'Laguna Loire' | ||
20 | }) | ||
21 | } | ||
22 | |||
23 | return null | ||
24 | } | ||
25 | }) | ||
26 | |||
27 | registerIdAndPassAuth({ | ||
28 | authName: 'ward-auth', | ||
29 | |||
30 | getWeight: () => 5, | ||
31 | |||
32 | login (body) { | ||
33 | if (body.id === 'ward') { | ||
34 | return Promise.resolve({ | ||
35 | username: 'ward-42', | ||
36 | email: 'ward@example.com' | ||
37 | }) | ||
38 | } | ||
39 | |||
40 | return null | ||
41 | } | ||
42 | }) | ||
43 | |||
44 | registerIdAndPassAuth({ | ||
45 | authName: 'kiros-auth', | ||
46 | |||
47 | getWeight: () => 5, | ||
48 | |||
49 | login (body) { | ||
50 | if (body.id === 'kiros') { | ||
51 | return Promise.resolve({ | ||
52 | username: 'kiros', | ||
53 | email: 'kiros@example.com', | ||
54 | displayName: 'a'.repeat(5000) | ||
55 | }) | ||
56 | } | ||
57 | |||
58 | return null | ||
59 | } | ||
60 | }) | ||
61 | |||
62 | registerIdAndPassAuth({ | ||
63 | authName: 'raine-auth', | ||
64 | |||
65 | getWeight: () => 5, | ||
66 | |||
67 | login (body) { | ||
68 | if (body.id === 'raine') { | ||
69 | return Promise.resolve({ | ||
70 | username: 'raine', | ||
71 | email: 'raine@example.com', | ||
72 | role: 42 | ||
73 | }) | ||
74 | } | ||
75 | |||
76 | return null | ||
77 | } | ||
78 | }) | ||
79 | |||
80 | registerIdAndPassAuth({ | ||
81 | authName: 'ellone-auth', | ||
82 | |||
83 | getWeight: () => 5, | ||
84 | |||
85 | login (body) { | ||
86 | if (body.id === 'ellone') { | ||
87 | return Promise.resolve({ | ||
88 | username: 'ellone' | ||
89 | }) | ||
90 | } | ||
91 | |||
92 | return null | ||
93 | } | ||
94 | }) | ||
95 | } | ||
96 | |||
97 | async function unregister () { | ||
98 | return | ||
99 | } | ||
100 | |||
101 | module.exports = { | ||
102 | register, | ||
103 | unregister | ||
104 | } | ||
105 | |||
106 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.json b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.json new file mode 100644 index 000000000..f9f107b1a --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-id-pass-auth-three", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Id and pass auth three", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js new file mode 100644 index 000000000..ceab7b60d --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js | |||
@@ -0,0 +1,54 @@ | |||
1 | async function register ({ | ||
2 | registerIdAndPassAuth, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | registerIdAndPassAuth({ | ||
6 | authName: 'laguna-auth', | ||
7 | |||
8 | onLogout: () => { | ||
9 | peertubeHelpers.logger.info('On logout for auth 2 - 1') | ||
10 | }, | ||
11 | |||
12 | getWeight: () => 30, | ||
13 | |||
14 | hookTokenValidity: (options) => { | ||
15 | if (options.type === 'refresh') { | ||
16 | return { valid: false } | ||
17 | } | ||
18 | |||
19 | if (options.type === 'access') { | ||
20 | const token = options.token | ||
21 | const now = new Date() | ||
22 | now.setTime(now.getTime() - 5000) | ||
23 | |||
24 | const createdAt = new Date(token.createdAt) | ||
25 | |||
26 | return { valid: createdAt.getTime() >= now.getTime() } | ||
27 | } | ||
28 | |||
29 | return { valid: true } | ||
30 | }, | ||
31 | |||
32 | login (body) { | ||
33 | if (body.id === 'laguna' && body.password === 'laguna password') { | ||
34 | return Promise.resolve({ | ||
35 | username: 'laguna', | ||
36 | email: 'laguna@example.com' | ||
37 | }) | ||
38 | } | ||
39 | |||
40 | return null | ||
41 | } | ||
42 | }) | ||
43 | } | ||
44 | |||
45 | async function unregister () { | ||
46 | return | ||
47 | } | ||
48 | |||
49 | module.exports = { | ||
50 | register, | ||
51 | unregister | ||
52 | } | ||
53 | |||
54 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.json b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.json new file mode 100644 index 000000000..5df15fac1 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-id-pass-auth-two", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Id and pass auth two", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-six/main.js b/server/tests/fixtures/peertube-plugin-test-six/main.js new file mode 100644 index 000000000..bb9aaffa7 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-six/main.js | |||
@@ -0,0 +1,25 @@ | |||
1 | async function register ({ | ||
2 | storageManager, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | const { logger } = peertubeHelpers | ||
6 | |||
7 | { | ||
8 | await storageManager.storeData('superkey', { value: 'toto' }) | ||
9 | await storageManager.storeData('anotherkey', { value: 'toto2' }) | ||
10 | |||
11 | const result = await storageManager.getData('superkey') | ||
12 | logger.info('superkey stored value is %s', result.value) | ||
13 | } | ||
14 | } | ||
15 | |||
16 | async function unregister () { | ||
17 | return | ||
18 | } | ||
19 | |||
20 | module.exports = { | ||
21 | register, | ||
22 | unregister | ||
23 | } | ||
24 | |||
25 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-six/package.json b/server/tests/fixtures/peertube-plugin-test-six/package.json new file mode 100644 index 000000000..8c97826b0 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-six/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-six", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Plugin test 6", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-three/main.js b/server/tests/fixtures/peertube-plugin-test-three/main.js index 4945feb55..f2b89bcf0 100644 --- a/server/tests/fixtures/peertube-plugin-test-three/main.js +++ b/server/tests/fixtures/peertube-plugin-test-three/main.js | |||
@@ -5,7 +5,9 @@ async function register ({ | |||
5 | storageManager, | 5 | storageManager, |
6 | videoCategoryManager, | 6 | videoCategoryManager, |
7 | videoLicenceManager, | 7 | videoLicenceManager, |
8 | videoLanguageManager | 8 | videoLanguageManager, |
9 | videoPrivacyManager, | ||
10 | playlistPrivacyManager | ||
9 | }) { | 11 | }) { |
10 | videoLanguageManager.addLanguage('al_bhed', 'Al Bhed') | 12 | videoLanguageManager.addLanguage('al_bhed', 'Al Bhed') |
11 | videoLanguageManager.addLanguage('al_bhed2', 'Al Bhed 2') | 13 | videoLanguageManager.addLanguage('al_bhed2', 'Al Bhed 2') |
@@ -21,6 +23,9 @@ async function register ({ | |||
21 | videoLicenceManager.addLicence(43, 'High best licence') | 23 | videoLicenceManager.addLicence(43, 'High best licence') |
22 | videoLicenceManager.deleteLicence(1) // Attribution | 24 | videoLicenceManager.deleteLicence(1) // Attribution |
23 | videoLicenceManager.deleteLicence(7) // Public domain | 25 | videoLicenceManager.deleteLicence(7) // Public domain |
26 | |||
27 | videoPrivacyManager.deletePrivacy(2) | ||
28 | playlistPrivacyManager.deletePlaylistPrivacy(3) | ||
24 | } | 29 | } |
25 | 30 | ||
26 | async function unregister () { | 31 | async function unregister () { |
diff --git a/server/tests/fixtures/video_import_preview.jpg b/server/tests/fixtures/video_import_preview.jpg new file mode 100644 index 000000000..1f8d1d91d --- /dev/null +++ b/server/tests/fixtures/video_import_preview.jpg | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/video_import_thumbnail.jpg b/server/tests/fixtures/video_import_thumbnail.jpg new file mode 100644 index 000000000..fcc50b75f --- /dev/null +++ b/server/tests/fixtures/video_import_thumbnail.jpg | |||
Binary files differ | |||