aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/external-plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/external-plugins
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/external-plugins')
-rw-r--r--server/tests/external-plugins/auth-ldap.ts34
-rw-r--r--server/tests/external-plugins/auto-block-videos.ts22
-rw-r--r--server/tests/external-plugins/auto-mute.ts34
3 files changed, 45 insertions, 45 deletions
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts
index b626ab2bb..ef624152e 100644
--- a/server/tests/external-plugins/auth-ldap.ts
+++ b/server/tests/external-plugins/auth-ldap.ts
@@ -16,15 +16,15 @@ describe('Official plugin auth-ldap', function () {
16 server = await flushAndRunServer(1) 16 server = await flushAndRunServer(1)
17 await setAccessTokensToServers([ server ]) 17 await setAccessTokensToServers([ server ])
18 18
19 await server.pluginsCommand.install({ npmName: 'peertube-plugin-auth-ldap' }) 19 await server.plugins.install({ npmName: 'peertube-plugin-auth-ldap' })
20 }) 20 })
21 21
22 it('Should not login with without LDAP settings', async function () { 22 it('Should not login with without LDAP settings', async function () {
23 await server.loginCommand.login({ user: { username: 'fry', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 23 await server.login.login({ user: { username: 'fry', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
24 }) 24 })
25 25
26 it('Should not login with bad LDAP settings', async function () { 26 it('Should not login with bad LDAP settings', async function () {
27 await server.pluginsCommand.updateSettings({ 27 await server.plugins.updateSettings({
28 npmName: 'peertube-plugin-auth-ldap', 28 npmName: 'peertube-plugin-auth-ldap',
29 settings: { 29 settings: {
30 'bind-credentials': 'GoodNewsEveryone', 30 'bind-credentials': 'GoodNewsEveryone',
@@ -38,11 +38,11 @@ describe('Official plugin auth-ldap', function () {
38 } 38 }
39 }) 39 })
40 40
41 await server.loginCommand.login({ user: { username: 'fry', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 41 await server.login.login({ user: { username: 'fry', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
42 }) 42 })
43 43
44 it('Should not login with good LDAP settings but wrong username/password', async function () { 44 it('Should not login with good LDAP settings but wrong username/password', async function () {
45 await server.pluginsCommand.updateSettings({ 45 await server.plugins.updateSettings({
46 npmName: 'peertube-plugin-auth-ldap', 46 npmName: 'peertube-plugin-auth-ldap',
47 settings: { 47 settings: {
48 'bind-credentials': 'GoodNewsEveryone', 48 'bind-credentials': 'GoodNewsEveryone',
@@ -56,20 +56,20 @@ describe('Official plugin auth-ldap', function () {
56 } 56 }
57 }) 57 })
58 58
59 await server.loginCommand.login({ user: { username: 'fry', password: 'bad password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 59 await server.login.login({ user: { username: 'fry', password: 'bad password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
60 await server.loginCommand.login({ user: { username: 'fryr', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 60 await server.login.login({ user: { username: 'fryr', password: 'fry' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
61 }) 61 })
62 62
63 it('Should login with the appropriate username/password', async function () { 63 it('Should login with the appropriate username/password', async function () {
64 accessToken = await server.loginCommand.getAccessToken({ username: 'fry', password: 'fry' }) 64 accessToken = await server.login.getAccessToken({ username: 'fry', password: 'fry' })
65 }) 65 })
66 66
67 it('Should login with the appropriate email/password', async function () { 67 it('Should login with the appropriate email/password', async function () {
68 accessToken = await server.loginCommand.getAccessToken({ username: 'fry@planetexpress.com', password: 'fry' }) 68 accessToken = await server.login.getAccessToken({ username: 'fry@planetexpress.com', password: 'fry' })
69 }) 69 })
70 70
71 it('Should login get my profile', async function () { 71 it('Should login get my profile', async function () {
72 const body = await server.usersCommand.getMyInfo({ token: accessToken }) 72 const body = await server.users.getMyInfo({ token: accessToken })
73 expect(body.username).to.equal('fry') 73 expect(body.username).to.equal('fry')
74 expect(body.email).to.equal('fry@planetexpress.com') 74 expect(body.email).to.equal('fry@planetexpress.com')
75 75
@@ -77,28 +77,28 @@ describe('Official plugin auth-ldap', function () {
77 }) 77 })
78 78
79 it('Should upload a video', async function () { 79 it('Should upload a video', async function () {
80 await server.videosCommand.upload({ token: accessToken, attributes: { name: 'my super video' } }) 80 await server.videos.upload({ token: accessToken, attributes: { name: 'my super video' } })
81 }) 81 })
82 82
83 it('Should not be able to login if the user is banned', async function () { 83 it('Should not be able to login if the user is banned', async function () {
84 await server.usersCommand.banUser({ userId }) 84 await server.users.banUser({ userId })
85 85
86 await server.loginCommand.login({ 86 await server.login.login({
87 user: { username: 'fry@planetexpress.com', password: 'fry' }, 87 user: { username: 'fry@planetexpress.com', password: 'fry' },
88 expectedStatus: HttpStatusCode.BAD_REQUEST_400 88 expectedStatus: HttpStatusCode.BAD_REQUEST_400
89 }) 89 })
90 }) 90 })
91 91
92 it('Should be able to login if the user is unbanned', async function () { 92 it('Should be able to login if the user is unbanned', async function () {
93 await server.usersCommand.unbanUser({ userId }) 93 await server.users.unbanUser({ userId })
94 94
95 await server.loginCommand.login({ user: { username: 'fry@planetexpress.com', password: 'fry' } }) 95 await server.login.login({ user: { username: 'fry@planetexpress.com', password: 'fry' } })
96 }) 96 })
97 97
98 it('Should not login if the plugin is uninstalled', async function () { 98 it('Should not login if the plugin is uninstalled', async function () {
99 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-auth-ldap' }) 99 await server.plugins.uninstall({ npmName: 'peertube-plugin-auth-ldap' })
100 100
101 await server.loginCommand.login({ 101 await server.login.login({
102 user: { username: 'fry@planetexpress.com', password: 'fry' }, 102 user: { username: 'fry@planetexpress.com', password: 'fry' },
103 expectedStatus: HttpStatusCode.BAD_REQUEST_400 103 expectedStatus: HttpStatusCode.BAD_REQUEST_400
104 }) 104 })
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts
index 1cce15a2f..3b4b48bf0 100644
--- a/server/tests/external-plugins/auto-block-videos.ts
+++ b/server/tests/external-plugins/auto-block-videos.ts
@@ -16,7 +16,7 @@ import {
16import { Video } from '@shared/models' 16import { Video } from '@shared/models'
17 17
18async function check (server: ServerInfo, videoUUID: string, exists = true) { 18async function check (server: ServerInfo, videoUUID: string, exists = true) {
19 const { data } = await server.videosCommand.list() 19 const { data } = await server.videos.list()
20 20
21 const video = data.find(v => v.uuid === videoUUID) 21 const video = data.find(v => v.uuid === videoUUID)
22 22
@@ -38,24 +38,24 @@ describe('Official plugin auto-block videos', function () {
38 await setAccessTokensToServers(servers) 38 await setAccessTokensToServers(servers)
39 39
40 for (const server of servers) { 40 for (const server of servers) {
41 await server.pluginsCommand.install({ npmName: 'peertube-plugin-auto-block-videos' }) 41 await server.plugins.install({ npmName: 'peertube-plugin-auto-block-videos' })
42 } 42 }
43 43
44 blocklistServer = new MockBlocklist() 44 blocklistServer = new MockBlocklist()
45 port = await blocklistServer.initialize() 45 port = await blocklistServer.initialize()
46 46
47 await await servers[0].videosCommand.quickUpload({ name: 'video server 1' }) 47 await await servers[0].videos.quickUpload({ name: 'video server 1' })
48 await await servers[1].videosCommand.quickUpload({ name: 'video server 2' }) 48 await await servers[1].videos.quickUpload({ name: 'video server 2' })
49 await await servers[1].videosCommand.quickUpload({ name: 'video 2 server 2' }) 49 await await servers[1].videos.quickUpload({ name: 'video 2 server 2' })
50 await await servers[1].videosCommand.quickUpload({ name: 'video 3 server 2' }) 50 await await servers[1].videos.quickUpload({ name: 'video 3 server 2' })
51 51
52 { 52 {
53 const { data } = await servers[0].videosCommand.list() 53 const { data } = await servers[0].videos.list()
54 server1Videos = data.map(v => Object.assign(v, { url: servers[0].url + '/videos/watch/' + v.uuid })) 54 server1Videos = data.map(v => Object.assign(v, { url: servers[0].url + '/videos/watch/' + v.uuid }))
55 } 55 }
56 56
57 { 57 {
58 const { data } = await servers[1].videosCommand.list() 58 const { data } = await servers[1].videos.list()
59 server2Videos = data.map(v => Object.assign(v, { url: servers[1].url + '/videos/watch/' + v.uuid })) 59 server2Videos = data.map(v => Object.assign(v, { url: servers[1].url + '/videos/watch/' + v.uuid }))
60 } 60 }
61 61
@@ -63,7 +63,7 @@ describe('Official plugin auto-block videos', function () {
63 }) 63 })
64 64
65 it('Should update plugin settings', async function () { 65 it('Should update plugin settings', async function () {
66 await servers[0].pluginsCommand.updateSettings({ 66 await servers[0].plugins.updateSettings({
67 npmName: 'peertube-plugin-auto-block-videos', 67 npmName: 'peertube-plugin-auto-block-videos',
68 settings: { 68 settings: {
69 'blocklist-urls': `http://localhost:${port}/blocklist`, 69 'blocklist-urls': `http://localhost:${port}/blocklist`,
@@ -91,7 +91,7 @@ describe('Official plugin auto-block videos', function () {
91 }) 91 })
92 92
93 it('Should have video in blacklists', async function () { 93 it('Should have video in blacklists', async function () {
94 const body = await servers[0].blacklistCommand.list() 94 const body = await servers[0].blacklist.list()
95 95
96 const videoBlacklists = body.data 96 const videoBlacklists = body.data
97 expect(videoBlacklists).to.have.lengthOf(1) 97 expect(videoBlacklists).to.have.lengthOf(1)
@@ -156,7 +156,7 @@ describe('Official plugin auto-block videos', function () {
156 156
157 await check(servers[0], video.uuid, false) 157 await check(servers[0], video.uuid, false)
158 158
159 await servers[0].blacklistCommand.remove({ videoId: video.uuid }) 159 await servers[0].blacklist.remove({ videoId: video.uuid })
160 160
161 await check(servers[0], video.uuid, true) 161 await check(servers[0], video.uuid, true)
162 162
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index 81a96744e..25b56a546 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -29,20 +29,20 @@ describe('Official plugin auto-mute', function () {
29 await setAccessTokensToServers(servers) 29 await setAccessTokensToServers(servers)
30 30
31 for (const server of servers) { 31 for (const server of servers) {
32 await server.pluginsCommand.install({ npmName: 'peertube-plugin-auto-mute' }) 32 await server.plugins.install({ npmName: 'peertube-plugin-auto-mute' })
33 } 33 }
34 34
35 blocklistServer = new MockBlocklist() 35 blocklistServer = new MockBlocklist()
36 port = await blocklistServer.initialize() 36 port = await blocklistServer.initialize()
37 37
38 await await servers[0].videosCommand.quickUpload({ name: 'video server 1' }) 38 await await servers[0].videos.quickUpload({ name: 'video server 1' })
39 await await servers[1].videosCommand.quickUpload({ name: 'video server 2' }) 39 await await servers[1].videos.quickUpload({ name: 'video server 2' })
40 40
41 await doubleFollow(servers[0], servers[1]) 41 await doubleFollow(servers[0], servers[1])
42 }) 42 })
43 43
44 it('Should update plugin settings', async function () { 44 it('Should update plugin settings', async function () {
45 await servers[0].pluginsCommand.updateSettings({ 45 await servers[0].plugins.updateSettings({
46 npmName: 'peertube-plugin-auto-mute', 46 npmName: 'peertube-plugin-auto-mute',
47 settings: { 47 settings: {
48 'blocklist-urls': `http://localhost:${port}/blocklist`, 48 'blocklist-urls': `http://localhost:${port}/blocklist`,
@@ -64,7 +64,7 @@ describe('Official plugin auto-mute', function () {
64 64
65 await wait(2000) 65 await wait(2000)
66 66
67 const { total } = await servers[0].videosCommand.list() 67 const { total } = await servers[0].videos.list()
68 expect(total).to.equal(1) 68 expect(total).to.equal(1)
69 }) 69 })
70 70
@@ -82,7 +82,7 @@ describe('Official plugin auto-mute', function () {
82 82
83 await wait(2000) 83 await wait(2000)
84 84
85 const { total } = await servers[0].videosCommand.list() 85 const { total } = await servers[0].videos.list()
86 expect(total).to.equal(2) 86 expect(total).to.equal(2)
87 }) 87 })
88 88
@@ -99,7 +99,7 @@ describe('Official plugin auto-mute', function () {
99 99
100 await wait(2000) 100 await wait(2000)
101 101
102 const { total } = await servers[0].videosCommand.list() 102 const { total } = await servers[0].videos.list()
103 expect(total).to.equal(1) 103 expect(total).to.equal(1)
104 }) 104 })
105 105
@@ -117,7 +117,7 @@ describe('Official plugin auto-mute', function () {
117 117
118 await wait(2000) 118 await wait(2000)
119 119
120 const { total } = await servers[0].videosCommand.list() 120 const { total } = await servers[0].videos.list()
121 expect(total).to.equal(2) 121 expect(total).to.equal(2)
122 }) 122 })
123 123
@@ -138,14 +138,14 @@ describe('Official plugin auto-mute', function () {
138 await wait(2000) 138 await wait(2000)
139 139
140 { 140 {
141 const { total } = await servers[0].videosCommand.list() 141 const { total } = await servers[0].videos.list()
142 expect(total).to.equal(1) 142 expect(total).to.equal(1)
143 } 143 }
144 144
145 await servers[0].blocklistCommand.removeFromServerBlocklist({ account }) 145 await servers[0].blocklist.removeFromServerBlocklist({ account })
146 146
147 { 147 {
148 const { total } = await servers[0].videosCommand.list() 148 const { total } = await servers[0].videos.list()
149 expect(total).to.equal(2) 149 expect(total).to.equal(2)
150 } 150 }
151 151
@@ -154,7 +154,7 @@ describe('Official plugin auto-mute', function () {
154 await wait(2000) 154 await wait(2000)
155 155
156 { 156 {
157 const { total } = await servers[0].videosCommand.list() 157 const { total } = await servers[0].videos.list()
158 expect(total).to.equal(2) 158 expect(total).to.equal(2)
159 } 159 }
160 }) 160 })
@@ -168,7 +168,7 @@ describe('Official plugin auto-mute', function () {
168 }) 168 })
169 169
170 it('Should enable auto mute list', async function () { 170 it('Should enable auto mute list', async function () {
171 await servers[0].pluginsCommand.updateSettings({ 171 await servers[0].plugins.updateSettings({
172 npmName: 'peertube-plugin-auto-mute', 172 npmName: 'peertube-plugin-auto-mute',
173 settings: { 173 settings: {
174 'blocklist-urls': '', 174 'blocklist-urls': '',
@@ -187,7 +187,7 @@ describe('Official plugin auto-mute', function () {
187 it('Should mute an account on server 1, and server 2 auto mutes it', async function () { 187 it('Should mute an account on server 1, and server 2 auto mutes it', async function () {
188 this.timeout(20000) 188 this.timeout(20000)
189 189
190 await servers[1].pluginsCommand.updateSettings({ 190 await servers[1].plugins.updateSettings({
191 npmName: 'peertube-plugin-auto-mute', 191 npmName: 'peertube-plugin-auto-mute',
192 settings: { 192 settings: {
193 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath, 193 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath,
@@ -196,8 +196,8 @@ describe('Official plugin auto-mute', function () {
196 } 196 }
197 }) 197 })
198 198
199 await servers[0].blocklistCommand.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) 199 await servers[0].blocklist.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port })
200 await servers[0].blocklistCommand.addToMyBlocklist({ server: 'localhost:' + servers[1].port }) 200 await servers[0].blocklist.addToMyBlocklist({ server: 'localhost:' + servers[1].port })
201 201
202 const res = await makeGetRequest({ 202 const res = await makeGetRequest({
203 url: servers[0].url, 203 url: servers[0].url,
@@ -213,7 +213,7 @@ describe('Official plugin auto-mute', function () {
213 await wait(2000) 213 await wait(2000)
214 214
215 for (const server of servers) { 215 for (const server of servers) {
216 const { total } = await server.videosCommand.list() 216 const { total } = await server.videos.list()
217 expect(total).to.equal(1) 217 expect(total).to.equal(1)
218 } 218 }
219 }) 219 })