aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/plugin-helpers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-22 10:55:28 +0200
committerChocobozzz <me@florianbigard.com>2021-04-22 10:55:28 +0200
commit302eba0d898e38dca14739486441c27c0be6c62f (patch)
tree280d18bfe2ad1b16248277371e609c31d6b3aaa4 /server/tests/plugins/plugin-helpers.ts
parent3e0e8d4afded28559b7c473061bbdc31ab542e1c (diff)
downloadPeerTube-302eba0d898e38dca14739486441c27c0be6c62f.tar.gz
PeerTube-302eba0d898e38dca14739486441c27c0be6c62f.tar.zst
PeerTube-302eba0d898e38dca14739486441c27c0be6c62f.zip
Add data directory for plugins and some helpers
Diffstat (limited to 'server/tests/plugins/plugin-helpers.ts')
-rw-r--r--server/tests/plugins/plugin-helpers.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 325d20e84..2ac070b41 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -100,6 +100,46 @@ describe('Test plugin helpers', function () {
100 100
101 expect(res.body.staticRoute).to.equal('/plugins/test-four/0.0.1/static/') 101 expect(res.body.staticRoute).to.equal('/plugins/test-four/0.0.1/static/')
102 }) 102 })
103
104 it('Should get the base static route', async function () {
105 const baseRouter = '/plugins/test-four/0.0.1/router/'
106
107 const res = await makeGetRequest({
108 url: servers[0].url,
109 path: baseRouter + 'router-route',
110 statusCodeExpected: HttpStatusCode.OK_200
111 })
112
113 expect(res.body.routerRoute).to.equal(baseRouter)
114 })
115 })
116
117 describe('User', function () {
118
119 it('Should not get a user if not authenticated', async function () {
120 const res = await makeGetRequest({
121 url: servers[0].url,
122 path: '/plugins/test-four/router/user',
123 statusCodeExpected: HttpStatusCode.OK_200
124 })
125
126 expect(res.body.user).to.be.undefined
127 })
128
129 it('Should get a user if authenticated', async function () {
130 const res = await makeGetRequest({
131 url: servers[0].url,
132 token: servers[0].accessToken,
133 path: '/plugins/test-four/router/user',
134 statusCodeExpected: HttpStatusCode.OK_200
135 })
136
137 expect(res.body.user).to.exist
138 expect(res.body.username).to.equal('root')
139 expect(res.body.isAdmin).to.be.true
140 expect(res.body.isModerator).to.be.false
141 expect(res.body.isUser).to.be.false
142 })
103 }) 143 })
104 144
105 describe('Moderation', function () { 145 describe('Moderation', function () {