aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-06 14:54:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-06 14:54:52 +0200
commit8d199cb823e1e47de87fdf421964e260b0ba6eb7 (patch)
tree563c5bd10235e69d84514a9b8348b525cc6d8765 /server/tests
parentbe587647f98a4b83ca06a61fe55c7ac5d60927c6 (diff)
downloadPeerTube-8d199cb823e1e47de87fdf421964e260b0ba6eb7.tar.gz
PeerTube-8d199cb823e1e47de87fdf421964e260b0ba6eb7.tar.zst
PeerTube-8d199cb823e1e47de87fdf421964e260b0ba6eb7.zip
Add tag search support to server
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/singlePod.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index ef882b080..5fcf5557f 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -187,6 +187,32 @@ describe('Test a single pod', function () {
187 }) 187 })
188 }) 188 })
189 189
190 it('Should search the video by tag', function (done) {
191 utils.searchVideo(server.url, 'tag1', 'tags', function (err, res) {
192 if (err) throw err
193
194 expect(res.body.total).to.equal(1)
195 expect(res.body.data).to.be.an('array')
196 expect(res.body.data.length).to.equal(1)
197
198 const video = res.body.data[0]
199 expect(video.name).to.equal('my super name')
200 expect(video.description).to.equal('my super description')
201 expect(video.podUrl).to.equal('localhost:9001')
202 expect(video.author).to.equal('root')
203 expect(video.isLocal).to.be.true
204 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
205 expect(utils.dateIsValid(video.createdDate)).to.be.true
206
207 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
208 if (err) throw err
209 expect(test).to.equal(true)
210
211 done()
212 })
213 })
214 })
215
190 it('Should not find a search by name by default', function (done) { 216 it('Should not find a search by name by default', function (done) {
191 utils.searchVideo(server.url, 'hello', function (err, res) { 217 utils.searchVideo(server.url, 'hello', function (err, res) {
192 if (err) throw err 218 if (err) throw err
@@ -211,6 +237,18 @@ describe('Test a single pod', function () {
211 }) 237 })
212 }) 238 })
213 239
240 it('Should not find a search by tag', function (done) {
241 utils.searchVideo(server.url, 'tag', 'tags', function (err, res) {
242 if (err) throw err
243
244 expect(res.body.total).to.equal(0)
245 expect(res.body.data).to.be.an('array')
246 expect(res.body.data.length).to.equal(0)
247
248 done()
249 })
250 })
251
214 it('Should remove the video', function (done) { 252 it('Should remove the video', function (done) {
215 utils.removeVideo(server.url, server.accessToken, videoId, function (err) { 253 utils.removeVideo(server.url, server.accessToken, videoId, function (err) {
216 if (err) throw err 254 if (err) throw err