aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts34
-rw-r--r--server/tests/api/videos/single-server.ts4
-rw-r--r--server/tests/api/videos/video-channels.ts6
-rw-r--r--server/tests/api/videos/video-comments.ts6
-rw-r--r--server/tests/api/videos/video-playlists.ts18
5 files changed, 34 insertions, 34 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 2ad749fd4..ff730287a 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -105,7 +105,7 @@ describe('Test multiple servers', function () {
105 originallyPublishedAt: '2019-02-10T13:38:14.449Z', 105 originallyPublishedAt: '2019-02-10T13:38:14.449Z',
106 account: { 106 account: {
107 name: 'root', 107 name: 'root',
108 host: 'localhost:' + servers[0].port 108 host: servers[0].host
109 }, 109 },
110 isLocal, 110 isLocal,
111 publishedAt, 111 publishedAt,
@@ -185,7 +185,7 @@ describe('Test multiple servers', function () {
185 185
186 // All servers should have this video 186 // All servers should have this video
187 for (const server of servers) { 187 for (const server of servers) {
188 const isLocal = server.url === 'http://localhost:' + servers[1].port 188 const isLocal = server.url === servers[1].url
189 const checkAttributes = { 189 const checkAttributes = {
190 name: 'my super name for server 2', 190 name: 'my super name for server 2',
191 category: 4, 191 category: 4,
@@ -196,7 +196,7 @@ describe('Test multiple servers', function () {
196 support: 'my super support text for server 2', 196 support: 'my super support text for server 2',
197 account: { 197 account: {
198 name: 'user1', 198 name: 'user1',
199 host: 'localhost:' + servers[1].port 199 host: servers[1].host
200 }, 200 },
201 isLocal, 201 isLocal,
202 commentsEnabled: true, 202 commentsEnabled: true,
@@ -279,7 +279,7 @@ describe('Test multiple servers', function () {
279 279
280 // All servers should have this video 280 // All servers should have this video
281 for (const server of servers) { 281 for (const server of servers) {
282 const isLocal = server.url === 'http://localhost:' + servers[2].port 282 const isLocal = server.url === servers[2].url
283 const { data } = await server.videos.list() 283 const { data } = await server.videos.list()
284 284
285 expect(data).to.be.an('array') 285 expect(data).to.be.an('array')
@@ -306,7 +306,7 @@ describe('Test multiple servers', function () {
306 support: 'my super support text for server 3', 306 support: 'my super support text for server 3',
307 account: { 307 account: {
308 name: 'root', 308 name: 'root',
309 host: 'localhost:' + servers[2].port 309 host: servers[2].host
310 }, 310 },
311 isLocal, 311 isLocal,
312 duration: 5, 312 duration: 5,
@@ -340,7 +340,7 @@ describe('Test multiple servers', function () {
340 support: 'my super support text for server 3-2', 340 support: 'my super support text for server 3-2',
341 account: { 341 account: {
342 name: 'root', 342 name: 'root',
343 host: 'localhost:' + servers[2].port 343 host: servers[2].host
344 }, 344 },
345 commentsEnabled: true, 345 commentsEnabled: true,
346 downloadEnabled: true, 346 downloadEnabled: true,
@@ -649,7 +649,7 @@ describe('Test multiple servers', function () {
649 649
650 expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin) 650 expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
651 651
652 const isLocal = server.url === 'http://localhost:' + servers[2].port 652 const isLocal = server.url === servers[2].url
653 const checkAttributes = { 653 const checkAttributes = {
654 name: 'my super video updated', 654 name: 'my super video updated',
655 category: 10, 655 category: 10,
@@ -661,7 +661,7 @@ describe('Test multiple servers', function () {
661 originallyPublishedAt: '2019-02-11T13:38:14.449Z', 661 originallyPublishedAt: '2019-02-11T13:38:14.449Z',
662 account: { 662 account: {
663 name: 'root', 663 name: 'root',
664 host: 'localhost:' + servers[2].port 664 host: servers[2].host
665 }, 665 },
666 isLocal, 666 isLocal,
667 duration: 5, 667 duration: 5,
@@ -830,7 +830,7 @@ describe('Test multiple servers', function () {
830 expect(comment).to.not.be.undefined 830 expect(comment).to.not.be.undefined
831 expect(comment.inReplyToCommentId).to.be.null 831 expect(comment.inReplyToCommentId).to.be.null
832 expect(comment.account.name).to.equal('root') 832 expect(comment.account.name).to.equal('root')
833 expect(comment.account.host).to.equal('localhost:' + servers[0].port) 833 expect(comment.account.host).to.equal(servers[0].host)
834 expect(comment.totalReplies).to.equal(3) 834 expect(comment.totalReplies).to.equal(3)
835 expect(dateIsValid(comment.createdAt as string)).to.be.true 835 expect(dateIsValid(comment.createdAt as string)).to.be.true
836 expect(dateIsValid(comment.updatedAt as string)).to.be.true 836 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -841,7 +841,7 @@ describe('Test multiple servers', function () {
841 expect(comment).to.not.be.undefined 841 expect(comment).to.not.be.undefined
842 expect(comment.inReplyToCommentId).to.be.null 842 expect(comment.inReplyToCommentId).to.be.null
843 expect(comment.account.name).to.equal('root') 843 expect(comment.account.name).to.equal('root')
844 expect(comment.account.host).to.equal('localhost:' + servers[2].port) 844 expect(comment.account.host).to.equal(servers[2].host)
845 expect(comment.totalReplies).to.equal(0) 845 expect(comment.totalReplies).to.equal(0)
846 expect(dateIsValid(comment.createdAt as string)).to.be.true 846 expect(dateIsValid(comment.createdAt as string)).to.be.true
847 expect(dateIsValid(comment.updatedAt as string)).to.be.true 847 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -858,25 +858,25 @@ describe('Test multiple servers', function () {
858 858
859 expect(tree.comment.text).equal('my super first comment') 859 expect(tree.comment.text).equal('my super first comment')
860 expect(tree.comment.account.name).equal('root') 860 expect(tree.comment.account.name).equal('root')
861 expect(tree.comment.account.host).equal('localhost:' + servers[0].port) 861 expect(tree.comment.account.host).equal(servers[0].host)
862 expect(tree.children).to.have.lengthOf(2) 862 expect(tree.children).to.have.lengthOf(2)
863 863
864 const firstChild = tree.children[0] 864 const firstChild = tree.children[0]
865 expect(firstChild.comment.text).to.equal('my super answer to thread 1') 865 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
866 expect(firstChild.comment.account.name).equal('root') 866 expect(firstChild.comment.account.name).equal('root')
867 expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port) 867 expect(firstChild.comment.account.host).equal(servers[1].host)
868 expect(firstChild.children).to.have.lengthOf(1) 868 expect(firstChild.children).to.have.lengthOf(1)
869 869
870 childOfFirstChild = firstChild.children[0] 870 childOfFirstChild = firstChild.children[0]
871 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') 871 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
872 expect(childOfFirstChild.comment.account.name).equal('root') 872 expect(childOfFirstChild.comment.account.name).equal('root')
873 expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port) 873 expect(childOfFirstChild.comment.account.host).equal(servers[2].host)
874 expect(childOfFirstChild.children).to.have.lengthOf(0) 874 expect(childOfFirstChild.children).to.have.lengthOf(0)
875 875
876 const secondChild = tree.children[1] 876 const secondChild = tree.children[1]
877 expect(secondChild.comment.text).to.equal('my second answer to thread 1') 877 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
878 expect(secondChild.comment.account.name).equal('root') 878 expect(secondChild.comment.account.name).equal('root')
879 expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port) 879 expect(secondChild.comment.account.host).equal(servers[2].host)
880 expect(secondChild.children).to.have.lengthOf(0) 880 expect(secondChild.children).to.have.lengthOf(0)
881 } 881 }
882 }) 882 })
@@ -935,7 +935,7 @@ describe('Test multiple servers', function () {
935 expect(comment).to.not.be.undefined 935 expect(comment).to.not.be.undefined
936 expect(comment.inReplyToCommentId).to.be.null 936 expect(comment.inReplyToCommentId).to.be.null
937 expect(comment.account.name).to.equal('root') 937 expect(comment.account.name).to.equal('root')
938 expect(comment.account.host).to.equal('localhost:' + servers[2].port) 938 expect(comment.account.host).to.equal(servers[2].host)
939 expect(comment.totalReplies).to.equal(0) 939 expect(comment.totalReplies).to.equal(0)
940 expect(dateIsValid(comment.createdAt as string)).to.be.true 940 expect(dateIsValid(comment.createdAt as string)).to.be.true
941 expect(dateIsValid(comment.updatedAt as string)).to.be.true 941 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -1042,7 +1042,7 @@ describe('Test multiple servers', function () {
1042 const { data } = await server.videos.list() 1042 const { data } = await server.videos.list()
1043 const video = data.find(v => v.name === 'minimum parameters') 1043 const video = data.find(v => v.name === 'minimum parameters')
1044 1044
1045 const isLocal = server.url === 'http://localhost:' + servers[1].port 1045 const isLocal = server.url === servers[1].url
1046 const checkAttributes = { 1046 const checkAttributes = {
1047 name: 'minimum parameters', 1047 name: 'minimum parameters',
1048 category: null, 1048 category: null,
@@ -1053,7 +1053,7 @@ describe('Test multiple servers', function () {
1053 support: null, 1053 support: null,
1054 account: { 1054 account: {
1055 name: 'root', 1055 name: 'root',
1056 host: 'localhost:' + servers[1].port 1056 host: servers[1].host
1057 }, 1057 },
1058 isLocal, 1058 isLocal,
1059 duration: 5, 1059 duration: 5,
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index da8bde07b..e8e981e55 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -33,7 +33,7 @@ describe('Test a single server', function () {
33 support: 'my super support text', 33 support: 'my super support text',
34 account: { 34 account: {
35 name: 'root', 35 name: 'root',
36 host: 'localhost:' + server.port 36 host: server.host
37 }, 37 },
38 isLocal: true, 38 isLocal: true,
39 duration: 5, 39 duration: 5,
@@ -66,7 +66,7 @@ describe('Test a single server', function () {
66 support: 'my super support text updated', 66 support: 'my super support text updated',
67 account: { 67 account: {
68 name: 'root', 68 name: 'root',
69 host: 'localhost:' + server.port 69 host: server.host
70 }, 70 },
71 isLocal: true, 71 isLocal: true,
72 tags: [ 'tagup1', 'tagup2' ], 72 tags: [ 'tagup1', 'tagup2' ],
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 86a8a038c..64bd4d9ae 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -373,7 +373,7 @@ describe('Test video channels', function () {
373 this.timeout(10000) 373 this.timeout(10000)
374 374
375 for (const server of servers) { 375 for (const server of servers) {
376 const channelURI = 'second_video_channel@localhost:' + servers[0].port 376 const channelURI = 'second_video_channel@' + servers[0].host
377 const { total, data } = await server.videos.listByChannel({ handle: channelURI }) 377 const { total, data } = await server.videos.listByChannel({ handle: channelURI })
378 378
379 expect(total).to.equal(1) 379 expect(total).to.equal(1)
@@ -396,13 +396,13 @@ describe('Test video channels', function () {
396 396
397 for (const server of servers) { 397 for (const server of servers) {
398 { 398 {
399 const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port 399 const secondChannelURI = 'second_video_channel@' + servers[0].host
400 const { total } = await server.videos.listByChannel({ handle: secondChannelURI }) 400 const { total } = await server.videos.listByChannel({ handle: secondChannelURI })
401 expect(total).to.equal(0) 401 expect(total).to.equal(0)
402 } 402 }
403 403
404 { 404 {
405 const channelURI = 'root_channel@localhost:' + servers[0].port 405 const channelURI = 'root_channel@' + servers[0].host
406 const { total, data } = await server.videos.listByChannel({ handle: channelURI }) 406 const { total, data } = await server.videos.listByChannel({ handle: channelURI })
407 expect(total).to.equal(1) 407 expect(total).to.equal(1)
408 408
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 348b408e8..dc47f8a4a 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -63,8 +63,8 @@ describe('Test video comments', function () {
63 expect(comment.videoId).to.equal(videoId) 63 expect(comment.videoId).to.equal(videoId)
64 expect(comment.id).to.equal(comment.threadId) 64 expect(comment.id).to.equal(comment.threadId)
65 expect(comment.account.name).to.equal('root') 65 expect(comment.account.name).to.equal('root')
66 expect(comment.account.host).to.equal('localhost:' + server.port) 66 expect(comment.account.host).to.equal(server.host)
67 expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root') 67 expect(comment.account.url).to.equal(server.url + '/accounts/root')
68 expect(comment.totalReplies).to.equal(0) 68 expect(comment.totalReplies).to.equal(0)
69 expect(comment.totalRepliesFromVideoAuthor).to.equal(0) 69 expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
70 expect(dateIsValid(comment.createdAt as string)).to.be.true 70 expect(dateIsValid(comment.createdAt as string)).to.be.true
@@ -85,7 +85,7 @@ describe('Test video comments', function () {
85 expect(comment.videoId).to.equal(videoId) 85 expect(comment.videoId).to.equal(videoId)
86 expect(comment.id).to.equal(comment.threadId) 86 expect(comment.id).to.equal(comment.threadId)
87 expect(comment.account.name).to.equal('root') 87 expect(comment.account.name).to.equal('root')
88 expect(comment.account.host).to.equal('localhost:' + server.port) 88 expect(comment.account.host).to.equal(server.host)
89 89
90 for (const avatar of comment.account.avatars) { 90 for (const avatar of comment.account.avatars) {
91 await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') 91 await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png')
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index a3de73ba5..6a18cf26a 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -404,7 +404,7 @@ describe('Test video playlists', function () {
404 it('Should not list unlisted or private playlists', async function () { 404 it('Should not list unlisted or private playlists', async function () {
405 for (const server of servers) { 405 for (const server of servers) {
406 const results = [ 406 const results = [
407 await server.playlists.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }), 407 await server.playlists.listByAccount({ handle: 'root@' + servers[1].host, sort: '-createdAt' }),
408 await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' }) 408 await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' })
409 ] 409 ]
410 410
@@ -701,52 +701,52 @@ describe('Test video playlists', function () {
701 const position = 2 701 const position = 2
702 702
703 { 703 {
704 await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) 704 await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })
705 await waitJobs(servers) 705 await waitJobs(servers)
706 706
707 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 707 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
708 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 708 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
709 709
710 await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) 710 await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })
711 await waitJobs(servers) 711 await waitJobs(servers)
712 712
713 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 713 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
714 } 714 }
715 715
716 { 716 {
717 await command.addToMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) 717 await command.addToMyBlocklist({ token: userTokenServer1, server: servers[1].host })
718 await waitJobs(servers) 718 await waitJobs(servers)
719 719
720 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 720 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
721 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 721 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
722 722
723 await command.removeFromMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) 723 await command.removeFromMyBlocklist({ token: userTokenServer1, server: servers[1].host })
724 await waitJobs(servers) 724 await waitJobs(servers)
725 725
726 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 726 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
727 } 727 }
728 728
729 { 729 {
730 await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) 730 await command.addToServerBlocklist({ account: 'root@' + servers[1].host })
731 await waitJobs(servers) 731 await waitJobs(servers)
732 732
733 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 733 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
734 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 734 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
735 735
736 await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port }) 736 await command.removeFromServerBlocklist({ account: 'root@' + servers[1].host })
737 await waitJobs(servers) 737 await waitJobs(servers)
738 738
739 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 739 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
740 } 740 }
741 741
742 { 742 {
743 await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) 743 await command.addToServerBlocklist({ server: servers[1].host })
744 await waitJobs(servers) 744 await waitJobs(servers)
745 745
746 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 746 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
747 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 747 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
748 748
749 await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) 749 await command.removeFromServerBlocklist({ server: servers[1].host })
750 await waitJobs(servers) 750 await waitJobs(servers)
751 751
752 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 752 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)