aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/fixtures/peertube-plugin-test-four/main.js13
-rw-r--r--server/tests/plugins/plugin-helpers.ts27
2 files changed, 39 insertions, 1 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js
index 8df456c8a..ea0599997 100644
--- a/server/tests/fixtures/peertube-plugin-test-four/main.js
+++ b/server/tests/fixtures/peertube-plugin-test-four/main.js
@@ -69,7 +69,20 @@ async function register ({
69 res.sendStatus(500) 69 res.sendStatus(500)
70 } 70 }
71 }) 71 })
72
73 router.get('/server-config', async (req, res) => {
74 const serverConfig = await peertubeHelpers.config.getServerConfig()
75
76 return res.json({ serverConfig })
77 })
78
79 router.get('/static-route', async (req, res) => {
80 const staticRoute = await peertubeHelpers.plugin.getBaseStaticRoute()
81
82 return res.json({ staticRoute })
83 })
72 } 84 }
85
73} 86}
74 87
75async function unregister () { 88async function unregister () {
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index a585e3020..325d20e84 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -12,7 +12,8 @@ import {
12 uploadVideoAndGetId, 12 uploadVideoAndGetId,
13 viewVideo, 13 viewVideo,
14 getVideosList, 14 getVideosList,
15 waitJobs 15 waitJobs,
16 makeGetRequest
16} from '../../../shared/extra-utils' 17} from '../../../shared/extra-utils'
17import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' 18import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
18import { expect } from 'chai' 19import { expect } from 'chai'
@@ -68,6 +69,17 @@ describe('Test plugin helpers', function () {
68 it('Should have the correct webserver url', async function () { 69 it('Should have the correct webserver url', async function () {
69 await waitUntilLog(servers[0], `server url is http://localhost:${servers[0].port}`) 70 await waitUntilLog(servers[0], `server url is http://localhost:${servers[0].port}`)
70 }) 71 })
72
73 it('Should have the correct config', async function () {
74 const res = await makeGetRequest({
75 url: servers[0].url,
76 path: '/plugins/test-four/router/server-config',
77 statusCodeExpected: HttpStatusCode.OK_200
78 })
79
80 expect(res.body.serverConfig).to.exist
81 expect(res.body.serverConfig.instance.name).to.equal('PeerTube')
82 })
71 }) 83 })
72 84
73 describe('Server', function () { 85 describe('Server', function () {
@@ -77,6 +89,19 @@ describe('Test plugin helpers', function () {
77 }) 89 })
78 }) 90 })
79 91
92 describe('Plugin', function () {
93
94 it('Should get the base static route', async function () {
95 const res = await makeGetRequest({
96 url: servers[0].url,
97 path: '/plugins/test-four/router/static-route',
98 statusCodeExpected: HttpStatusCode.OK_200
99 })
100
101 expect(res.body.staticRoute).to.equal('/plugins/test-four/0.0.1/static/')
102 })
103 })
104
80 describe('Moderation', function () { 105 describe('Moderation', function () {
81 let videoUUIDServer1: string 106 let videoUUIDServer1: string
82 107