aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
commit0a6658fdcbd779ada8f3758048c326e997902d5a (patch)
tree5de40bf901db0299011104b1344783637b964eb0 /server/tests
parente6d4b0ff2404dcf0b3a755c3fcc415ffeb6e754d (diff)
downloadPeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.gz
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.zst
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.zip
Use global uuid instead of remoteId for videos
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/remotes.js2
-rw-r--r--server/tests/api/multiple-pods.js31
-rw-r--r--server/tests/api/single-pod.js21
3 files changed, 51 insertions, 3 deletions
diff --git a/server/tests/api/check-params/remotes.js b/server/tests/api/check-params/remotes.js
index 96361c643..7cb99c4ae 100644
--- a/server/tests/api/check-params/remotes.js
+++ b/server/tests/api/check-params/remotes.js
@@ -44,7 +44,7 @@ describe('Test remote videos API validators', function () {
44 describe('When adding a video', function () { 44 describe('When adding a video', function () {
45 it('Should check when adding a video') 45 it('Should check when adding a video')
46 46
47 it('Should not add an existing remoteId and host pair') 47 it('Should not add an existing uuid')
48 }) 48 })
49 49
50 describe('When removing a video', function () { 50 describe('When removing a video', function () {
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js
index c3ee77f0c..1bc6157e8 100644
--- a/server/tests/api/multiple-pods.js
+++ b/server/tests/api/multiple-pods.js
@@ -20,6 +20,7 @@ const videosUtils = require('../utils/videos')
20describe('Test multiple pods', function () { 20describe('Test multiple pods', function () {
21 let servers = [] 21 let servers = []
22 const toRemove = [] 22 const toRemove = []
23 let videoUUID = ''
23 24
24 before(function (done) { 25 before(function (done) {
25 this.timeout(120000) 26 this.timeout(120000)
@@ -746,6 +747,36 @@ describe('Test multiple pods', function () {
746 expect(videos[0].name).not.to.equal(toRemove[1].name) 747 expect(videos[0].name).not.to.equal(toRemove[1].name)
747 expect(videos[1].name).not.to.equal(toRemove[1].name) 748 expect(videos[1].name).not.to.equal(toRemove[1].name)
748 749
750 videoUUID = videos[0].uuid
751
752 callback()
753 })
754 }, done)
755 })
756
757 it('Should get the same video by UUID on each pod', function (done) {
758 let baseVideo = null
759 each(servers, function (server, callback) {
760 videosUtils.getVideo(server.url, videoUUID, function (err, res) {
761 if (err) throw err
762
763 const video = res.body
764
765 if (baseVideo === null) {
766 baseVideo = video
767 return callback()
768 }
769
770 expect(baseVideo.name).to.equal(video.name)
771 expect(baseVideo.uuid).to.equal(video.uuid)
772 expect(baseVideo.category).to.equal(video.category)
773 expect(baseVideo.language).to.equal(video.language)
774 expect(baseVideo.licence).to.equal(video.licence)
775 expect(baseVideo.category).to.equal(video.category)
776 expect(baseVideo.nsfw).to.equal(video.nsfw)
777 expect(baseVideo.author).to.equal(video.author)
778 expect(baseVideo.tags).to.deep.equal(video.tags)
779
749 callback() 780 callback()
750 }) 781 })
751 }, done) 782 }, done)
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index e08da0517..0dac9a183 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -19,6 +19,7 @@ const videosUtils = require('../utils/videos')
19describe('Test a single pod', function () { 19describe('Test a single pod', function () {
20 let server = null 20 let server = null
21 let videoId = -1 21 let videoId = -1
22 let videoUUID = ''
22 let videosListBase = null 23 let videosListBase = null
23 24
24 before(function (done) { 25 before(function (done) {
@@ -140,6 +141,7 @@ describe('Test a single pod', function () {
140 expect(test).to.equal(true) 141 expect(test).to.equal(true)
141 142
142 videoId = video.id 143 videoId = video.id
144 videoUUID = video.uuid
143 145
144 webtorrent.add(video.magnetUri, function (torrent) { 146 webtorrent.add(video.magnetUri, function (torrent) {
145 expect(torrent.files).to.exist 147 expect(torrent.files).to.exist
@@ -181,18 +183,33 @@ describe('Test a single pod', function () {
181 if (err) throw err 183 if (err) throw err
182 expect(test).to.equal(true) 184 expect(test).to.equal(true)
183 185
184 // Wait the async views increment 186 // Wait the async views increment
185 setTimeout(done, 500) 187 setTimeout(done, 500)
186 }) 188 })
187 }) 189 })
188 }) 190 })
189 191
192 it('Should get the video by UUID', function (done) {
193 // Yes, this could be long
194 this.timeout(60000)
195
196 videosUtils.getVideo(server.url, videoUUID, function (err, res) {
197 if (err) throw err
198
199 const video = res.body
200 expect(video.name).to.equal('my super name')
201
202 // Wait the async views increment
203 setTimeout(done, 500)
204 })
205 })
206
190 it('Should have the views updated', function (done) { 207 it('Should have the views updated', function (done) {
191 videosUtils.getVideo(server.url, videoId, function (err, res) { 208 videosUtils.getVideo(server.url, videoId, function (err, res) {
192 if (err) throw err 209 if (err) throw err
193 210
194 const video = res.body 211 const video = res.body
195 expect(video.views).to.equal(1) 212 expect(video.views).to.equal(2)
196 213
197 done() 214 done()
198 }) 215 })