diff options
Diffstat (limited to 'server/tests/api/single-pod.js')
-rw-r--r-- | server/tests/api/single-pod.js | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index 96e4aff9e..d583592d8 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -44,6 +44,19 @@ describe('Test a single pod', function () { | |||
44 | ], done) | 44 | ], done) |
45 | }) | 45 | }) |
46 | 46 | ||
47 | it('Should list video categories', function (done) { | ||
48 | videosUtils.getVideoCategories(server.url, function (err, res) { | ||
49 | if (err) throw err | ||
50 | |||
51 | const categories = res.body | ||
52 | expect(Object.keys(categories)).to.have.length.above(10) | ||
53 | |||
54 | expect(categories[11]).to.equal('News') | ||
55 | |||
56 | done() | ||
57 | }) | ||
58 | }) | ||
59 | |||
47 | it('Should not have videos', function (done) { | 60 | it('Should not have videos', function (done) { |
48 | videosUtils.getVideosList(server.url, function (err, res) { | 61 | videosUtils.getVideosList(server.url, function (err, res) { |
49 | if (err) throw err | 62 | if (err) throw err |
@@ -60,9 +73,10 @@ describe('Test a single pod', function () { | |||
60 | this.timeout(5000) | 73 | this.timeout(5000) |
61 | const name = 'my super name' | 74 | const name = 'my super name' |
62 | const description = 'my super description' | 75 | const description = 'my super description' |
76 | const category = 2 | ||
63 | const tags = [ 'tag1', 'tag2', 'tag3' ] | 77 | const tags = [ 'tag1', 'tag2', 'tag3' ] |
64 | const file = 'video_short.webm' | 78 | const file = 'video_short.webm' |
65 | videosUtils.uploadVideo(server.url, server.accessToken, name, description, tags, file, done) | 79 | videosUtils.uploadVideo(server.url, server.accessToken, name, category, description, tags, file, done) |
66 | }) | 80 | }) |
67 | 81 | ||
68 | it('Should seed the uploaded video', function (done) { | 82 | it('Should seed the uploaded video', function (done) { |
@@ -78,6 +92,8 @@ describe('Test a single pod', function () { | |||
78 | 92 | ||
79 | const video = res.body.data[0] | 93 | const video = res.body.data[0] |
80 | expect(video.name).to.equal('my super name') | 94 | expect(video.name).to.equal('my super name') |
95 | expect(video.category).to.equal(2) | ||
96 | expect(video.categoryLabel).to.equal('Films') | ||
81 | expect(video.description).to.equal('my super description') | 97 | expect(video.description).to.equal('my super description') |
82 | expect(video.podHost).to.equal('localhost:9001') | 98 | expect(video.podHost).to.equal('localhost:9001') |
83 | expect(video.magnetUri).to.exist | 99 | expect(video.magnetUri).to.exist |
@@ -113,6 +129,8 @@ describe('Test a single pod', function () { | |||
113 | 129 | ||
114 | const video = res.body | 130 | const video = res.body |
115 | expect(video.name).to.equal('my super name') | 131 | expect(video.name).to.equal('my super name') |
132 | expect(video.category).to.equal(2) | ||
133 | expect(video.categoryLabel).to.equal('Films') | ||
116 | expect(video.description).to.equal('my super description') | 134 | expect(video.description).to.equal('my super description') |
117 | expect(video.podHost).to.equal('localhost:9001') | 135 | expect(video.podHost).to.equal('localhost:9001') |
118 | expect(video.magnetUri).to.exist | 136 | expect(video.magnetUri).to.exist |
@@ -152,6 +170,8 @@ describe('Test a single pod', function () { | |||
152 | 170 | ||
153 | const video = res.body.data[0] | 171 | const video = res.body.data[0] |
154 | expect(video.name).to.equal('my super name') | 172 | expect(video.name).to.equal('my super name') |
173 | expect(video.category).to.equal(2) | ||
174 | expect(video.categoryLabel).to.equal('Films') | ||
155 | expect(video.description).to.equal('my super description') | 175 | expect(video.description).to.equal('my super description') |
156 | expect(video.podHost).to.equal('localhost:9001') | 176 | expect(video.podHost).to.equal('localhost:9001') |
157 | expect(video.author).to.equal('root') | 177 | expect(video.author).to.equal('root') |
@@ -207,6 +227,8 @@ describe('Test a single pod', function () { | |||
207 | 227 | ||
208 | const video = res.body.data[0] | 228 | const video = res.body.data[0] |
209 | expect(video.name).to.equal('my super name') | 229 | expect(video.name).to.equal('my super name') |
230 | expect(video.category).to.equal(2) | ||
231 | expect(video.categoryLabel).to.equal('Films') | ||
210 | expect(video.description).to.equal('my super description') | 232 | expect(video.description).to.equal('my super description') |
211 | expect(video.podHost).to.equal('localhost:9001') | 233 | expect(video.podHost).to.equal('localhost:9001') |
212 | expect(video.author).to.equal('root') | 234 | expect(video.author).to.equal('root') |
@@ -301,9 +323,10 @@ describe('Test a single pod', function () { | |||
301 | each(videos, function (video, callbackEach) { | 323 | each(videos, function (video, callbackEach) { |
302 | const name = video + ' name' | 324 | const name = video + ' name' |
303 | const description = video + ' description' | 325 | const description = video + ' description' |
326 | const category = 2 | ||
304 | const tags = [ 'tag1', 'tag2', 'tag3' ] | 327 | const tags = [ 'tag1', 'tag2', 'tag3' ] |
305 | 328 | ||
306 | videosUtils.uploadVideo(server.url, server.accessToken, name, description, tags, video, callbackEach) | 329 | videosUtils.uploadVideo(server.url, server.accessToken, name, category, description, tags, video, callbackEach) |
307 | }, done) | 330 | }, done) |
308 | }) | 331 | }) |
309 | 332 | ||
@@ -468,7 +491,7 @@ describe('Test a single pod', function () { | |||
468 | // }) | 491 | // }) |
469 | // }) | 492 | // }) |
470 | 493 | ||
471 | it('Should search the good magnetUri video', function (done) { | 494 | it('Should search the right magnetUri video', function (done) { |
472 | const video = videosListBase[0] | 495 | const video = videosListBase[0] |
473 | videosUtils.searchVideoWithPagination(server.url, encodeURIComponent(video.magnetUri), 'magnetUri', 0, 15, function (err, res) { | 496 | videosUtils.searchVideoWithPagination(server.url, encodeURIComponent(video.magnetUri), 'magnetUri', 0, 15, function (err, res) { |
474 | if (err) throw err | 497 | if (err) throw err |
@@ -521,10 +544,11 @@ describe('Test a single pod', function () { | |||
521 | 544 | ||
522 | it('Should update a video', function (done) { | 545 | it('Should update a video', function (done) { |
523 | const name = 'my super video updated' | 546 | const name = 'my super video updated' |
547 | const category = 4 | ||
524 | const description = 'my super description updated' | 548 | const description = 'my super description updated' |
525 | const tags = [ 'tagup1', 'tagup2' ] | 549 | const tags = [ 'tagup1', 'tagup2' ] |
526 | 550 | ||
527 | videosUtils.updateVideo(server.url, server.accessToken, videoId, name, description, tags, done) | 551 | videosUtils.updateVideo(server.url, server.accessToken, videoId, name, category, description, tags, done) |
528 | }) | 552 | }) |
529 | 553 | ||
530 | it('Should have the video updated', function (done) { | 554 | it('Should have the video updated', function (done) { |
@@ -536,6 +560,8 @@ describe('Test a single pod', function () { | |||
536 | const video = res.body | 560 | const video = res.body |
537 | 561 | ||
538 | expect(video.name).to.equal('my super video updated') | 562 | expect(video.name).to.equal('my super video updated') |
563 | expect(video.category).to.equal(4) | ||
564 | expect(video.categoryLabel).to.equal('Art') | ||
539 | expect(video.description).to.equal('my super description updated') | 565 | expect(video.description).to.equal('my super description updated') |
540 | expect(video.podHost).to.equal('localhost:9001') | 566 | expect(video.podHost).to.equal('localhost:9001') |
541 | expect(video.author).to.equal('root') | 567 | expect(video.author).to.equal('root') |
@@ -562,7 +588,7 @@ describe('Test a single pod', function () { | |||
562 | it('Should update only the tags of a video', function (done) { | 588 | it('Should update only the tags of a video', function (done) { |
563 | const tags = [ 'tag1', 'tag2', 'supertag' ] | 589 | const tags = [ 'tag1', 'tag2', 'supertag' ] |
564 | 590 | ||
565 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, tags, function (err) { | 591 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, null, tags, function (err) { |
566 | if (err) throw err | 592 | if (err) throw err |
567 | 593 | ||
568 | videosUtils.getVideo(server.url, videoId, function (err, res) { | 594 | videosUtils.getVideo(server.url, videoId, function (err, res) { |
@@ -571,6 +597,8 @@ describe('Test a single pod', function () { | |||
571 | const video = res.body | 597 | const video = res.body |
572 | 598 | ||
573 | expect(video.name).to.equal('my super video updated') | 599 | expect(video.name).to.equal('my super video updated') |
600 | expect(video.category).to.equal(4) | ||
601 | expect(video.categoryLabel).to.equal('Art') | ||
574 | expect(video.description).to.equal('my super description updated') | 602 | expect(video.description).to.equal('my super description updated') |
575 | expect(video.podHost).to.equal('localhost:9001') | 603 | expect(video.podHost).to.equal('localhost:9001') |
576 | expect(video.author).to.equal('root') | 604 | expect(video.author).to.equal('root') |
@@ -587,7 +615,7 @@ describe('Test a single pod', function () { | |||
587 | it('Should update only the description of a video', function (done) { | 615 | it('Should update only the description of a video', function (done) { |
588 | const description = 'hello everybody' | 616 | const description = 'hello everybody' |
589 | 617 | ||
590 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, description, null, function (err) { | 618 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, description, null, function (err) { |
591 | if (err) throw err | 619 | if (err) throw err |
592 | 620 | ||
593 | videosUtils.getVideo(server.url, videoId, function (err, res) { | 621 | videosUtils.getVideo(server.url, videoId, function (err, res) { |
@@ -596,6 +624,8 @@ describe('Test a single pod', function () { | |||
596 | const video = res.body | 624 | const video = res.body |
597 | 625 | ||
598 | expect(video.name).to.equal('my super video updated') | 626 | expect(video.name).to.equal('my super video updated') |
627 | expect(video.category).to.equal(4) | ||
628 | expect(video.categoryLabel).to.equal('Art') | ||
599 | expect(video.description).to.equal('hello everybody') | 629 | expect(video.description).to.equal('hello everybody') |
600 | expect(video.podHost).to.equal('localhost:9001') | 630 | expect(video.podHost).to.equal('localhost:9001') |
601 | expect(video.author).to.equal('root') | 631 | expect(video.author).to.equal('root') |