aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/video-constants.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/video-constants.ts')
-rw-r--r--server/tests/plugins/video-constants.ts55
1 files changed, 52 insertions, 3 deletions
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index 5374b5ecc..fec9196e2 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -4,17 +4,18 @@ import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers' 5import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
6import { 6import {
7 createVideoPlaylist,
7 getPluginTestPath, 8 getPluginTestPath,
8 getVideo, 9 getVideo,
9 getVideoCategories, 10 getVideoCategories,
10 getVideoLanguages, 11 getVideoLanguages,
11 getVideoLicences, 12 getVideoLicences, getVideoPlaylistPrivacies, getVideoPrivacies,
12 installPlugin, 13 installPlugin,
13 setAccessTokensToServers, 14 setAccessTokensToServers,
14 uninstallPlugin, 15 uninstallPlugin,
15 uploadVideo 16 uploadVideo
16} from '../../../shared/extra-utils' 17} from '../../../shared/extra-utils'
17import { VideoDetails } from '../../../shared/models/videos' 18import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos'
18 19
19const expect = chai.expect 20const expect = chai.expect
20 21
@@ -67,6 +68,35 @@ describe('Test plugin altering video constants', function () {
67 expect(licences[43]).to.equal('High best licence') 68 expect(licences[43]).to.equal('High best licence')
68 }) 69 })
69 70
71 it('Should have updated video privacies', async function () {
72 const res = await getVideoPrivacies(server.url)
73 const privacies = res.body
74
75 expect(privacies[1]).to.exist
76 expect(privacies[2]).to.not.exist
77 expect(privacies[3]).to.exist
78 expect(privacies[4]).to.exist
79 })
80
81 it('Should have updated playlist privacies', async function () {
82 const res = await getVideoPlaylistPrivacies(server.url)
83 const playlistPrivacies = res.body
84
85 expect(playlistPrivacies[1]).to.exist
86 expect(playlistPrivacies[2]).to.exist
87 expect(playlistPrivacies[3]).to.not.exist
88 })
89
90 it('Should not be able to create a video with this privacy', async function () {
91 const attrs = { name: 'video', privacy: 2 }
92 await uploadVideo(server.url, server.accessToken, attrs, 400)
93 })
94
95 it('Should not be able to create a video with this privacy', async function () {
96 const attrs = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE }
97 await createVideoPlaylist({ url: server.url, token: server.accessToken, playlistAttrs: attrs, expectedStatus: 400 })
98 })
99
70 it('Should be able to upload a video with these values', async function () { 100 it('Should be able to upload a video with these values', async function () {
71 const attrs = { name: 'video', category: 42, licence: 42, language: 'al_bhed2' } 101 const attrs = { name: 'video', category: 42, licence: 42, language: 'al_bhed2' }
72 const resUpload = await uploadVideo(server.url, server.accessToken, attrs) 102 const resUpload = await uploadVideo(server.url, server.accessToken, attrs)
@@ -79,7 +109,7 @@ describe('Test plugin altering video constants', function () {
79 expect(video.category.label).to.equal('Best category') 109 expect(video.category.label).to.equal('Best category')
80 }) 110 })
81 111
82 it('Should uninstall the plugin and reset languages, categories and licences', async function () { 112 it('Should uninstall the plugin and reset languages, categories, licences and privacies', async function () {
83 await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-three' }) 113 await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-three' })
84 114
85 { 115 {
@@ -114,6 +144,25 @@ describe('Test plugin altering video constants', function () {
114 expect(licences[42]).to.not.exist 144 expect(licences[42]).to.not.exist
115 expect(licences[43]).to.not.exist 145 expect(licences[43]).to.not.exist
116 } 146 }
147
148 {
149 const res = await getVideoPrivacies(server.url)
150 const privacies = res.body
151
152 expect(privacies[1]).to.exist
153 expect(privacies[2]).to.exist
154 expect(privacies[3]).to.exist
155 expect(privacies[4]).to.exist
156 }
157
158 {
159 const res = await getVideoPlaylistPrivacies(server.url)
160 const playlistPrivacies = res.body
161
162 expect(playlistPrivacies[1]).to.exist
163 expect(playlistPrivacies[2]).to.exist
164 expect(playlistPrivacies[3]).to.exist
165 }
117 }) 166 })
118 167
119 after(async function () { 168 after(async function () {