diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-02-28 08:34:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 08:34:43 +0100 |
commit | d0800f7661f13fabe7bb6f4aa0ea50764f106405 (patch) | |
tree | d43e6b0b6f4a5a32e03487e6464edbcaf288be2a /server/tests | |
parent | 5cad2ca9db9b9d138f8a33058d10b94a9fd50c69 (diff) | |
download | PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.gz PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.zst PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.zip |
Implement avatar miniatures (#4639)
* client: remove unused file
* refactor(client/my-actor-avatar): size from input
Read size from component input instead of scss, to make it possible to
use smaller avatar images when implemented.
* implement avatar miniatures
close #4560
* fix(test): max file size
* fix(search-index): normalize res acc to avatarMini
* refactor avatars to an array
* client/search: resize channel avatar to 120
* refactor(client/videos): remove unused function
* client(actor-avatar): set default size
* fix tests and avatars full result
When findOne is used only an array containting one avatar is returned.
* update migration version and version notations
* server/search: harmonize normalizing
* Cleanup avatar miniature PR
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/tests')
31 files changed, 173 insertions, 51 deletions
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index 1e9732fe9..5c2650fac 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -228,7 +228,7 @@ describe('Test video channels API validator', function () { | |||
228 | }) | 228 | }) |
229 | }) | 229 | }) |
230 | 230 | ||
231 | describe('When updating video channel avatar/banner', function () { | 231 | describe('When updating video channel avatars/banners', function () { |
232 | const types = [ 'avatar', 'banner' ] | 232 | const types = [ 'avatar', 'banner' ] |
233 | let path: string | 233 | let path: string |
234 | 234 | ||
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts index 0c3bed3e7..7bf49c7ec 100644 --- a/server/tests/api/moderation/abuses.ts +++ b/server/tests/api/moderation/abuses.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | AbusesCommand, | 7 | AbusesCommand, |
7 | cleanupTests, | 8 | cleanupTests, |
@@ -9,9 +10,10 @@ import { | |||
9 | doubleFollow, | 10 | doubleFollow, |
10 | PeerTubeServer, | 11 | PeerTubeServer, |
11 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultChannelAvatar, | ||
12 | waitJobs | 15 | waitJobs |
13 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
14 | import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models' | ||
15 | 17 | ||
16 | const expect = chai.expect | 18 | const expect = chai.expect |
17 | 19 | ||
@@ -27,8 +29,9 @@ describe('Test abuses', function () { | |||
27 | // Run servers | 29 | // Run servers |
28 | servers = await createMultipleServers(2) | 30 | servers = await createMultipleServers(2) |
29 | 31 | ||
30 | // Get the access tokens | ||
31 | await setAccessTokensToServers(servers) | 32 | await setAccessTokensToServers(servers) |
33 | await setDefaultChannelAvatar(servers) | ||
34 | await setDefaultAccountAvatar(servers) | ||
32 | 35 | ||
33 | // Server 1 and server 2 follow each other | 36 | // Server 1 and server 2 follow each other |
34 | await doubleFollow(servers[0], servers[1]) | 37 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index b45460bb4..e1344a245 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { UserNotificationType } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | BlocklistCommand, | 7 | BlocklistCommand, |
7 | cleanupTests, | 8 | cleanupTests, |
@@ -10,9 +11,9 @@ import { | |||
10 | doubleFollow, | 11 | doubleFollow, |
11 | PeerTubeServer, | 12 | PeerTubeServer, |
12 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | setDefaultAccountAvatar, | ||
13 | waitJobs | 15 | waitJobs |
14 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
15 | import { UserNotificationType } from '@shared/models' | ||
16 | 17 | ||
17 | const expect = chai.expect | 18 | const expect = chai.expect |
18 | 19 | ||
@@ -79,6 +80,7 @@ describe('Test blocklist', function () { | |||
79 | 80 | ||
80 | servers = await createMultipleServers(3) | 81 | servers = await createMultipleServers(3) |
81 | await setAccessTokensToServers(servers) | 82 | await setAccessTokensToServers(servers) |
83 | await setDefaultAccountAvatar(servers) | ||
82 | 84 | ||
83 | command = servers[0].blocklist | 85 | command = servers[0].blocklist |
84 | commentsCommand = servers.map(s => s.comments) | 86 | commentsCommand = servers.map(s => s.comments) |
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts index 3e7f2ba33..1790210ff 100644 --- a/server/tests/api/moderation/video-blacklist.ts +++ b/server/tests/api/moderation/video-blacklist.ts | |||
@@ -13,6 +13,7 @@ import { | |||
13 | killallServers, | 13 | killallServers, |
14 | PeerTubeServer, | 14 | PeerTubeServer, |
15 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
16 | setDefaultChannelAvatar, | ||
16 | waitJobs | 17 | waitJobs |
17 | } from '@shared/server-commands' | 18 | } from '@shared/server-commands' |
18 | 19 | ||
@@ -42,6 +43,7 @@ describe('Test video blacklist', function () { | |||
42 | 43 | ||
43 | // Server 1 and server 2 follow each other | 44 | // Server 1 and server 2 follow each other |
44 | await doubleFollow(servers[0], servers[1]) | 45 | await doubleFollow(servers[0], servers[1]) |
46 | await setDefaultChannelAvatar(servers[0]) | ||
45 | 47 | ||
46 | // Upload 2 videos on server 2 | 48 | // Upload 2 videos on server 2 |
47 | await servers[1].videos.upload({ attributes: { name: 'My 1st video', description: 'A video on server 2' } }) | 49 | await servers[1].videos.upload({ attributes: { name: 'My 1st video', description: 'A video on server 2' } }) |
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index ac08449f8..78864c8a0 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts | |||
@@ -38,6 +38,16 @@ describe('Test notifications API', function () { | |||
38 | await waitJobs([ server ]) | 38 | await waitJobs([ server ]) |
39 | }) | 39 | }) |
40 | 40 | ||
41 | describe('Notification list & count', function () { | ||
42 | |||
43 | it('Should correctly list notifications', async function () { | ||
44 | const { data, total } = await server.notifications.list({ token: userToken, start: 0, count: 2 }) | ||
45 | |||
46 | expect(data).to.have.lengthOf(2) | ||
47 | expect(total).to.equal(10) | ||
48 | }) | ||
49 | }) | ||
50 | |||
41 | describe('Mark as read', function () { | 51 | describe('Mark as read', function () { |
42 | 52 | ||
43 | it('Should mark as read some notifications', async function () { | 53 | it('Should mark as read some notifications', async function () { |
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 2e0abc6ba..5f5322d03 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -10,6 +10,8 @@ import { | |||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | SearchCommand, | 11 | SearchCommand, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultVideoChannel, | ||
13 | waitJobs | 15 | waitJobs |
14 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
15 | 17 | ||
@@ -28,6 +30,8 @@ describe('Test ActivityPub video channels search', function () { | |||
28 | servers = await createMultipleServers(2) | 30 | servers = await createMultipleServers(2) |
29 | 31 | ||
30 | await setAccessTokensToServers(servers) | 32 | await setAccessTokensToServers(servers) |
33 | await setDefaultVideoChannel(servers) | ||
34 | await setDefaultAccountAvatar(servers) | ||
31 | 35 | ||
32 | { | 36 | { |
33 | await servers[0].users.create({ username: 'user1_server1', password: 'password' }) | 37 | await servers[0].users.create({ username: 'user1_server1', password: 'password' }) |
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts index d9243ac53..b9a424292 100644 --- a/server/tests/api/search/search-activitypub-video-playlists.ts +++ b/server/tests/api/search/search-activitypub-video-playlists.ts | |||
@@ -10,6 +10,7 @@ import { | |||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | SearchCommand, | 11 | SearchCommand, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
13 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
14 | waitJobs | 15 | waitJobs |
15 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
@@ -31,6 +32,7 @@ describe('Test ActivityPub playlists search', function () { | |||
31 | 32 | ||
32 | await setAccessTokensToServers(servers) | 33 | await setAccessTokensToServers(servers) |
33 | await setDefaultVideoChannel(servers) | 34 | await setDefaultVideoChannel(servers) |
35 | await setDefaultAccountAvatar(servers) | ||
34 | 36 | ||
35 | { | 37 | { |
36 | const video1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).uuid | 38 | const video1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).uuid |
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 60b95ae4c..20249b1f1 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -10,6 +10,8 @@ import { | |||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | SearchCommand, | 11 | SearchCommand, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultVideoChannel, | ||
13 | waitJobs | 15 | waitJobs |
14 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
15 | 17 | ||
@@ -28,6 +30,8 @@ describe('Test ActivityPub videos search', function () { | |||
28 | servers = await createMultipleServers(2) | 30 | servers = await createMultipleServers(2) |
29 | 31 | ||
30 | await setAccessTokensToServers(servers) | 32 | await setAccessTokensToServers(servers) |
33 | await setDefaultVideoChannel(servers) | ||
34 | await setDefaultAccountAvatar(servers) | ||
31 | 35 | ||
32 | { | 36 | { |
33 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video 1 on server 1' } }) | 37 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video 1 on server 1' } }) |
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index 8a92def61..0073c71e1 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts | |||
@@ -2,15 +2,17 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoChannel } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | cleanupTests, | 7 | cleanupTests, |
7 | createSingleServer, | 8 | createSingleServer, |
8 | doubleFollow, | 9 | doubleFollow, |
9 | PeerTubeServer, | 10 | PeerTubeServer, |
10 | SearchCommand, | 11 | SearchCommand, |
11 | setAccessTokensToServers | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultChannelAvatar | ||
12 | } from '@shared/server-commands' | 15 | } from '@shared/server-commands' |
13 | import { VideoChannel } from '@shared/models' | ||
14 | 16 | ||
15 | const expect = chai.expect | 17 | const expect = chai.expect |
16 | 18 | ||
@@ -30,6 +32,8 @@ describe('Test channels search', function () { | |||
30 | remoteServer = servers[1] | 32 | remoteServer = servers[1] |
31 | 33 | ||
32 | await setAccessTokensToServers([ server, remoteServer ]) | 34 | await setAccessTokensToServers([ server, remoteServer ]) |
35 | await setDefaultChannelAvatar(server) | ||
36 | await setDefaultAccountAvatar(server) | ||
33 | 37 | ||
34 | { | 38 | { |
35 | await server.users.create({ username: 'user1' }) | 39 | await server.users.create({ username: 'user1' }) |
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index f84d03345..ae933449f 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts | |||
@@ -14,7 +14,7 @@ import { | |||
14 | 14 | ||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test videos search', function () { | 17 | describe('Test index search', function () { |
18 | const localVideoName = 'local video' + new Date().toISOString() | 18 | const localVideoName = 'local video' + new Date().toISOString() |
19 | 19 | ||
20 | let server: PeerTubeServer = null | 20 | let server: PeerTubeServer = null |
@@ -134,12 +134,16 @@ describe('Test videos search', function () { | |||
134 | expect(video.account.host).to.equal('framatube.org') | 134 | expect(video.account.host).to.equal('framatube.org') |
135 | expect(video.account.name).to.equal('framasoft') | 135 | expect(video.account.name).to.equal('framasoft') |
136 | expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft') | 136 | expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft') |
137 | // TODO: remove, deprecated in 4.2 | ||
137 | expect(video.account.avatar).to.exist | 138 | expect(video.account.avatar).to.exist |
139 | expect(video.account.avatars.length).to.equal(1, 'Account should have one avatar image') | ||
138 | 140 | ||
139 | expect(video.channel.host).to.equal('framatube.org') | 141 | expect(video.channel.host).to.equal('framatube.org') |
140 | expect(video.channel.name).to.equal('joinpeertube') | 142 | expect(video.channel.name).to.equal('joinpeertube') |
141 | expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube') | 143 | expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube') |
144 | // TODO: remove, deprecated in 4.2 | ||
142 | expect(video.channel.avatar).to.exist | 145 | expect(video.channel.avatar).to.exist |
146 | expect(video.channel.avatars.length).to.equal(1, 'Channel should have one avatar image') | ||
143 | } | 147 | } |
144 | 148 | ||
145 | const baseSearch: VideosSearchQuery = { | 149 | const baseSearch: VideosSearchQuery = { |
@@ -316,13 +320,17 @@ describe('Test videos search', function () { | |||
316 | const videoChannel = body.data[0] | 320 | const videoChannel = body.data[0] |
317 | expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8') | 321 | expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8') |
318 | expect(videoChannel.host).to.equal('framatube.org') | 322 | expect(videoChannel.host).to.equal('framatube.org') |
323 | // TODO: remove, deprecated in 4.2 | ||
319 | expect(videoChannel.avatar).to.exist | 324 | expect(videoChannel.avatar).to.exist |
325 | expect(videoChannel.avatars.length).to.equal(1, 'Channel should have two avatar images') | ||
320 | expect(videoChannel.displayName).to.exist | 326 | expect(videoChannel.displayName).to.exist |
321 | 327 | ||
322 | expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft') | 328 | expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft') |
323 | expect(videoChannel.ownerAccount.name).to.equal('framasoft') | 329 | expect(videoChannel.ownerAccount.name).to.equal('framasoft') |
324 | expect(videoChannel.ownerAccount.host).to.equal('framatube.org') | 330 | expect(videoChannel.ownerAccount.host).to.equal('framatube.org') |
331 | // TODO: remove, deprecated in 4.2 | ||
325 | expect(videoChannel.ownerAccount.avatar).to.exist | 332 | expect(videoChannel.ownerAccount.avatar).to.exist |
333 | expect(videoChannel.ownerAccount.avatars.length).to.equal(1, 'Account should have two avatar images') | ||
326 | } | 334 | } |
327 | 335 | ||
328 | it('Should make a simple search and not have results', async function () { | 336 | it('Should make a simple search and not have results', async function () { |
@@ -388,12 +396,16 @@ describe('Test videos search', function () { | |||
388 | expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz') | 396 | expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz') |
389 | expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz') | 397 | expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz') |
390 | expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re') | 398 | expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re') |
399 | // TODO: remove, deprecated in 4.2 | ||
391 | expect(videoPlaylist.ownerAccount.avatar).to.exist | 400 | expect(videoPlaylist.ownerAccount.avatar).to.exist |
401 | expect(videoPlaylist.ownerAccount.avatars.length).to.equal(1, 'Account should have two avatar images') | ||
392 | 402 | ||
393 | expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel') | 403 | expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel') |
394 | expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel') | 404 | expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel') |
395 | expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re') | 405 | expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re') |
406 | // TODO: remove, deprecated in 4.2 | ||
396 | expect(videoPlaylist.videoChannel.avatar).to.exist | 407 | expect(videoPlaylist.videoChannel.avatar).to.exist |
408 | expect(videoPlaylist.videoChannel.avatars.length).to.equal(1, 'Channel should have two avatar images') | ||
397 | } | 409 | } |
398 | 410 | ||
399 | it('Should make a simple search and not have results', async function () { | 411 | it('Should make a simple search and not have results', async function () { |
diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index 1e9c8d4bb..fcf2f2ee2 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoPlaylistPrivacy } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | cleanupTests, | 7 | cleanupTests, |
7 | createSingleServer, | 8 | createSingleServer, |
@@ -9,9 +10,10 @@ import { | |||
9 | PeerTubeServer, | 10 | PeerTubeServer, |
10 | SearchCommand, | 11 | SearchCommand, |
11 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultChannelAvatar, | ||
12 | setDefaultVideoChannel | 15 | setDefaultVideoChannel |
13 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
14 | import { VideoPlaylistPrivacy } from '@shared/models' | ||
15 | 17 | ||
16 | const expect = chai.expect | 18 | const expect = chai.expect |
17 | 19 | ||
@@ -34,6 +36,8 @@ describe('Test playlists search', function () { | |||
34 | 36 | ||
35 | await setAccessTokensToServers([ remoteServer, server ]) | 37 | await setAccessTokensToServers([ remoteServer, server ]) |
36 | await setDefaultVideoChannel([ remoteServer, server ]) | 38 | await setDefaultVideoChannel([ remoteServer, server ]) |
39 | await setDefaultChannelAvatar([ remoteServer, server ]) | ||
40 | await setDefaultAccountAvatar([ remoteServer, server ]) | ||
37 | 41 | ||
38 | { | 42 | { |
39 | const videoId = (await server.videos.upload()).uuid | 43 | const videoId = (await server.videos.upload()).uuid |
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index c544705d3..ff4c3c161 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { wait } from '@shared/core-utils' | ||
6 | import { VideoPrivacy } from '@shared/models' | ||
5 | import { | 7 | import { |
6 | cleanupTests, | 8 | cleanupTests, |
7 | createSingleServer, | 9 | createSingleServer, |
@@ -9,11 +11,11 @@ import { | |||
9 | PeerTubeServer, | 11 | PeerTubeServer, |
10 | SearchCommand, | 12 | SearchCommand, |
11 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | setDefaultAccountAvatar, | ||
15 | setDefaultChannelAvatar, | ||
12 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
13 | stopFfmpeg | 17 | stopFfmpeg |
14 | } from '@shared/server-commands' | 18 | } from '@shared/server-commands' |
15 | import { VideoPrivacy } from '@shared/models' | ||
16 | import { wait } from '@shared/core-utils' | ||
17 | 19 | ||
18 | const expect = chai.expect | 20 | const expect = chai.expect |
19 | 21 | ||
@@ -38,6 +40,8 @@ describe('Test videos search', function () { | |||
38 | 40 | ||
39 | await setAccessTokensToServers([ server, remoteServer ]) | 41 | await setAccessTokensToServers([ server, remoteServer ]) |
40 | await setDefaultVideoChannel([ server, remoteServer ]) | 42 | await setDefaultVideoChannel([ server, remoteServer ]) |
43 | await setDefaultChannelAvatar(server) | ||
44 | await setDefaultAccountAvatar(servers) | ||
41 | 45 | ||
42 | { | 46 | { |
43 | const attributes1 = { | 47 | const attributes1 = { |
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts index 552ee98cf..e7de6bfee 100644 --- a/server/tests/api/server/homepage.ts +++ b/server/tests/api/server/homepage.ts | |||
@@ -9,7 +9,9 @@ import { | |||
9 | CustomPagesCommand, | 9 | CustomPagesCommand, |
10 | killallServers, | 10 | killallServers, |
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers | 12 | setAccessTokensToServers, |
13 | setDefaultAccountAvatar, | ||
14 | setDefaultChannelAvatar | ||
13 | } from '../../../../shared/server-commands/index' | 15 | } from '../../../../shared/server-commands/index' |
14 | 16 | ||
15 | const expect = chai.expect | 17 | const expect = chai.expect |
@@ -29,6 +31,8 @@ describe('Test instance homepage actions', function () { | |||
29 | 31 | ||
30 | server = await createSingleServer(1) | 32 | server = await createSingleServer(1) |
31 | await setAccessTokensToServers([ server ]) | 33 | await setAccessTokensToServers([ server ]) |
34 | await setDefaultChannelAvatar(server) | ||
35 | await setDefaultAccountAvatar(server) | ||
32 | 36 | ||
33 | command = server.customPage | 37 | command = server.customPage |
34 | }) | 38 | }) |
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index 57cca6ad4..9553a69bb 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts | |||
@@ -9,6 +9,8 @@ import { | |||
9 | doubleFollow, | 9 | doubleFollow, |
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | setDefaultAccountAvatar, | ||
13 | setDefaultChannelAvatar, | ||
12 | SubscriptionsCommand, | 14 | SubscriptionsCommand, |
13 | waitJobs | 15 | waitJobs |
14 | } from '@shared/server-commands' | 16 | } from '@shared/server-commands' |
@@ -29,6 +31,8 @@ describe('Test users subscriptions', function () { | |||
29 | 31 | ||
30 | // Get the access tokens | 32 | // Get the access tokens |
31 | await setAccessTokensToServers(servers) | 33 | await setAccessTokensToServers(servers) |
34 | await setDefaultChannelAvatar(servers) | ||
35 | await setDefaultAccountAvatar(servers) | ||
32 | 36 | ||
33 | // Server 1 and server 2 follow each other | 37 | // Server 1 and server 2 follow each other |
34 | await doubleFollow(servers[0], servers[1]) | 38 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 5b2bbc520..3e8b932c0 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -16,6 +16,7 @@ import { | |||
16 | doubleFollow, | 16 | doubleFollow, |
17 | PeerTubeServer, | 17 | PeerTubeServer, |
18 | setAccessTokensToServers, | 18 | setAccessTokensToServers, |
19 | setDefaultChannelAvatar, | ||
19 | waitJobs | 20 | waitJobs |
20 | } from '@shared/server-commands' | 21 | } from '@shared/server-commands' |
21 | 22 | ||
@@ -29,7 +30,7 @@ describe('Test users with multiple servers', function () { | |||
29 | 30 | ||
30 | let videoUUID: string | 31 | let videoUUID: string |
31 | let userAccessToken: string | 32 | let userAccessToken: string |
32 | let userAvatarFilename: string | 33 | let userAvatarFilenames: string[] |
33 | 34 | ||
34 | before(async function () { | 35 | before(async function () { |
35 | this.timeout(120_000) | 36 | this.timeout(120_000) |
@@ -38,6 +39,7 @@ describe('Test users with multiple servers', function () { | |||
38 | 39 | ||
39 | // Get the access tokens | 40 | // Get the access tokens |
40 | await setAccessTokensToServers(servers) | 41 | await setAccessTokensToServers(servers) |
42 | await setDefaultChannelAvatar(servers) | ||
41 | 43 | ||
42 | // Server 1 and server 2 follow each other | 44 | // Server 1 and server 2 follow each other |
43 | await doubleFollow(servers[0], servers[1]) | 45 | await doubleFollow(servers[0], servers[1]) |
@@ -97,9 +99,11 @@ describe('Test users with multiple servers', function () { | |||
97 | await servers[0].users.updateMyAvatar({ fixture }) | 99 | await servers[0].users.updateMyAvatar({ fixture }) |
98 | 100 | ||
99 | user = await servers[0].users.getMyInfo() | 101 | user = await servers[0].users.getMyInfo() |
100 | userAvatarFilename = user.account.avatar.path | 102 | userAvatarFilenames = user.account.avatars.map(({ path }) => path) |
101 | 103 | ||
102 | await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png') | 104 | for (const avatar of user.account.avatars) { |
105 | await testImage(servers[0].url, `avatar2-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') | ||
106 | } | ||
103 | 107 | ||
104 | await waitJobs(servers) | 108 | await waitJobs(servers) |
105 | }) | 109 | }) |
@@ -129,7 +133,9 @@ describe('Test users with multiple servers', function () { | |||
129 | expect(account.userId).to.be.undefined | 133 | expect(account.userId).to.be.undefined |
130 | } | 134 | } |
131 | 135 | ||
132 | await testImage(server.url, 'avatar2-resized', account.avatar.path, '.png') | 136 | for (const avatar of account.avatars) { |
137 | await testImage(server.url, `avatar2-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') | ||
138 | } | ||
133 | } | 139 | } |
134 | }) | 140 | }) |
135 | 141 | ||
@@ -193,7 +199,9 @@ describe('Test users with multiple servers', function () { | |||
193 | 199 | ||
194 | it('Should not have actor files', async () => { | 200 | it('Should not have actor files', async () => { |
195 | for (const server of servers) { | 201 | for (const server of servers) { |
196 | await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) | 202 | for (const userAvatarFilename of userAvatarFilenames) { |
203 | await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) | ||
204 | } | ||
197 | } | 205 | } |
198 | }) | 206 | }) |
199 | 207 | ||
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 7023b3f08..a47713bf0 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -604,7 +604,9 @@ describe('Test users', function () { | |||
604 | await server.users.updateMyAvatar({ token: userToken, fixture }) | 604 | await server.users.updateMyAvatar({ token: userToken, fixture }) |
605 | 605 | ||
606 | const user = await server.users.getMyInfo({ token: userToken }) | 606 | const user = await server.users.getMyInfo({ token: userToken }) |
607 | await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.gif') | 607 | for (const avatar of user.account.avatars) { |
608 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif') | ||
609 | } | ||
608 | }) | 610 | }) |
609 | 611 | ||
610 | it('Should be able to update my avatar with a gif, and then a png', async function () { | 612 | it('Should be able to update my avatar with a gif, and then a png', async function () { |
@@ -614,7 +616,9 @@ describe('Test users', function () { | |||
614 | await server.users.updateMyAvatar({ token: userToken, fixture }) | 616 | await server.users.updateMyAvatar({ token: userToken, fixture }) |
615 | 617 | ||
616 | const user = await server.users.getMyInfo({ token: userToken }) | 618 | const user = await server.users.getMyInfo({ token: userToken }) |
617 | await testImage(server.url, 'avatar-resized', user.account.avatar.path, extension) | 619 | for (const avatar of user.account.avatars) { |
620 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension) | ||
621 | } | ||
618 | } | 622 | } |
619 | }) | 623 | }) |
620 | 624 | ||
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index ecdd36613..5bbc60559 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -19,6 +19,8 @@ import { | |||
19 | doubleFollow, | 19 | doubleFollow, |
20 | PeerTubeServer, | 20 | PeerTubeServer, |
21 | setAccessTokensToServers, | 21 | setAccessTokensToServers, |
22 | setDefaultAccountAvatar, | ||
23 | setDefaultChannelAvatar, | ||
22 | waitJobs, | 24 | waitJobs, |
23 | webtorrentAdd | 25 | webtorrentAdd |
24 | } from '@shared/server-commands' | 26 | } from '@shared/server-commands' |
@@ -46,6 +48,9 @@ describe('Test multiple servers', function () { | |||
46 | description: 'super channel' | 48 | description: 'super channel' |
47 | } | 49 | } |
48 | await servers[0].channels.create({ attributes: videoChannel }) | 50 | await servers[0].channels.create({ attributes: videoChannel }) |
51 | await setDefaultChannelAvatar(servers[0], videoChannel.name) | ||
52 | await setDefaultAccountAvatar(servers) | ||
53 | |||
49 | const { data } = await servers[0].channels.list({ start: 0, count: 1 }) | 54 | const { data } = await servers[0].channels.list({ start: 0, count: 1 }) |
50 | videoChannelId = data[0].id | 55 | videoChannelId = data[0].id |
51 | } | 56 | } |
@@ -207,7 +212,7 @@ describe('Test multiple servers', function () { | |||
207 | }, | 212 | }, |
208 | { | 213 | { |
209 | resolution: 720, | 214 | resolution: 720, |
210 | size: 788000 | 215 | size: 750000 |
211 | } | 216 | } |
212 | ], | 217 | ], |
213 | thumbnailfile: 'thumbnail', | 218 | thumbnailfile: 'thumbnail', |
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 28bf018c5..d37043aef 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -5,7 +5,14 @@ import * as chai from 'chai' | |||
5 | import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' | 5 | import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' |
6 | import { wait } from '@shared/core-utils' | 6 | import { wait } from '@shared/core-utils' |
7 | import { Video, VideoPrivacy } from '@shared/models' | 7 | import { Video, VideoPrivacy } from '@shared/models' |
8 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 8 | import { |
9 | cleanupTests, | ||
10 | createSingleServer, | ||
11 | PeerTubeServer, | ||
12 | setAccessTokensToServers, | ||
13 | setDefaultAccountAvatar, | ||
14 | setDefaultChannelAvatar | ||
15 | } from '@shared/server-commands' | ||
9 | 16 | ||
10 | const expect = chai.expect | 17 | const expect = chai.expect |
11 | 18 | ||
@@ -90,6 +97,8 @@ describe('Test a single server', function () { | |||
90 | server = await createSingleServer(1) | 97 | server = await createSingleServer(1) |
91 | 98 | ||
92 | await setAccessTokensToServers([ server ]) | 99 | await setAccessTokensToServers([ server ]) |
100 | await setDefaultChannelAvatar(server) | ||
101 | await setDefaultAccountAvatar(server) | ||
93 | }) | 102 | }) |
94 | 103 | ||
95 | it('Should list video categories', async function () { | 104 | it('Should list video categories', async function () { |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index d435f3682..0f8227fd3 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -6,13 +6,14 @@ import { basename } from 'path' | |||
6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' | 6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' |
7 | import { testFileExistsOrNot, testImage } from '@server/tests/shared' | 7 | import { testFileExistsOrNot, testImage } from '@server/tests/shared' |
8 | import { wait } from '@shared/core-utils' | 8 | import { wait } from '@shared/core-utils' |
9 | import { User, VideoChannel } from '@shared/models' | 9 | import { ActorImageType, User, VideoChannel } from '@shared/models' |
10 | import { | 10 | import { |
11 | cleanupTests, | 11 | cleanupTests, |
12 | createMultipleServers, | 12 | createMultipleServers, |
13 | doubleFollow, | 13 | doubleFollow, |
14 | PeerTubeServer, | 14 | PeerTubeServer, |
15 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
16 | setDefaultAccountAvatar, | ||
16 | setDefaultVideoChannel, | 17 | setDefaultVideoChannel, |
17 | waitJobs | 18 | waitJobs |
18 | } from '@shared/server-commands' | 19 | } from '@shared/server-commands' |
@@ -44,6 +45,7 @@ describe('Test video channels', function () { | |||
44 | 45 | ||
45 | await setAccessTokensToServers(servers) | 46 | await setAccessTokensToServers(servers) |
46 | await setDefaultVideoChannel(servers) | 47 | await setDefaultVideoChannel(servers) |
48 | await setDefaultAccountAvatar(servers) | ||
47 | 49 | ||
48 | await doubleFollow(servers[0], servers[1]) | 50 | await doubleFollow(servers[0], servers[1]) |
49 | }) | 51 | }) |
@@ -281,14 +283,19 @@ describe('Test video channels', function () { | |||
281 | 283 | ||
282 | for (const server of servers) { | 284 | for (const server of servers) { |
283 | const videoChannel = await findChannel(server, secondVideoChannelId) | 285 | const videoChannel = await findChannel(server, secondVideoChannelId) |
286 | const expectedSizes = ACTOR_IMAGES_SIZE[ActorImageType.AVATAR] | ||
284 | 287 | ||
285 | avatarPaths[server.port] = videoChannel.avatar.path | 288 | expect(videoChannel.avatars.length).to.equal(expectedSizes.length, 'Expected avatars to be generated in all sizes') |
286 | await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') | ||
287 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) | ||
288 | 289 | ||
289 | const row = await server.sql.getActorImage(basename(avatarPaths[server.port])) | 290 | for (const avatar of videoChannel.avatars) { |
290 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) | 291 | avatarPaths[server.port] = avatar.path |
291 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) | 292 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatarPaths[server.port], '.png') |
293 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) | ||
294 | |||
295 | const row = await server.sql.getActorImage(basename(avatarPaths[server.port])) | ||
296 | |||
297 | expect(expectedSizes.some(({ height, width }) => row.height === height && row.width === width)).to.equal(true) | ||
298 | } | ||
292 | } | 299 | } |
293 | }) | 300 | }) |
294 | 301 | ||
@@ -308,19 +315,18 @@ describe('Test video channels', function () { | |||
308 | for (const server of servers) { | 315 | for (const server of servers) { |
309 | const videoChannel = await server.channels.get({ channelName: 'second_video_channel@' + servers[0].host }) | 316 | const videoChannel = await server.channels.get({ channelName: 'second_video_channel@' + servers[0].host }) |
310 | 317 | ||
311 | bannerPaths[server.port] = videoChannel.banner.path | 318 | bannerPaths[server.port] = videoChannel.banners[0].path |
312 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) | 319 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) |
313 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) | 320 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) |
314 | 321 | ||
315 | const row = await server.sql.getActorImage(basename(bannerPaths[server.port])) | 322 | const row = await server.sql.getActorImage(basename(bannerPaths[server.port])) |
316 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) | 323 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE[ActorImageType.BANNER][0].height) |
317 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) | 324 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE[ActorImageType.BANNER][0].width) |
318 | } | 325 | } |
319 | }) | 326 | }) |
320 | 327 | ||
321 | it('Should delete the video channel avatar', async function () { | 328 | it('Should delete the video channel avatar', async function () { |
322 | this.timeout(15000) | 329 | this.timeout(15000) |
323 | |||
324 | await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'avatar' }) | 330 | await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'avatar' }) |
325 | 331 | ||
326 | await waitJobs(servers) | 332 | await waitJobs(servers) |
@@ -329,7 +335,7 @@ describe('Test video channels', function () { | |||
329 | const videoChannel = await findChannel(server, secondVideoChannelId) | 335 | const videoChannel = await findChannel(server, secondVideoChannelId) |
330 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), false) | 336 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), false) |
331 | 337 | ||
332 | expect(videoChannel.avatar).to.be.null | 338 | expect(videoChannel.avatars).to.be.empty |
333 | } | 339 | } |
334 | }) | 340 | }) |
335 | 341 | ||
@@ -344,7 +350,7 @@ describe('Test video channels', function () { | |||
344 | const videoChannel = await findChannel(server, secondVideoChannelId) | 350 | const videoChannel = await findChannel(server, secondVideoChannelId) |
345 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), false) | 351 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), false) |
346 | 352 | ||
347 | expect(videoChannel.banner).to.be.null | 353 | expect(videoChannel.banners).to.be.empty |
348 | } | 354 | } |
349 | }) | 355 | }) |
350 | 356 | ||
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 2ae523970..1488ce2b5 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -3,7 +3,15 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { dateIsValid, testImage } from '@server/tests/shared' | 5 | import { dateIsValid, testImage } from '@server/tests/shared' |
6 | import { cleanupTests, CommentsCommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 6 | import { |
7 | cleanupTests, | ||
8 | CommentsCommand, | ||
9 | createSingleServer, | ||
10 | PeerTubeServer, | ||
11 | setAccessTokensToServers, | ||
12 | setDefaultAccountAvatar, | ||
13 | setDefaultChannelAvatar | ||
14 | } from '@shared/server-commands' | ||
7 | 15 | ||
8 | const expect = chai.expect | 16 | const expect = chai.expect |
9 | 17 | ||
@@ -29,7 +37,8 @@ describe('Test video comments', function () { | |||
29 | videoUUID = uuid | 37 | videoUUID = uuid |
30 | videoId = id | 38 | videoId = id |
31 | 39 | ||
32 | await server.users.updateMyAvatar({ fixture: 'avatar.png' }) | 40 | await setDefaultChannelAvatar(server) |
41 | await setDefaultAccountAvatar(server) | ||
33 | 42 | ||
34 | userAccessTokenServer1 = await server.users.generateUserAndToken('user1') | 43 | userAccessTokenServer1 = await server.users.generateUserAndToken('user1') |
35 | 44 | ||
@@ -81,7 +90,9 @@ describe('Test video comments', function () { | |||
81 | expect(comment.account.name).to.equal('root') | 90 | expect(comment.account.name).to.equal('root') |
82 | expect(comment.account.host).to.equal('localhost:' + server.port) | 91 | expect(comment.account.host).to.equal('localhost:' + server.port) |
83 | 92 | ||
84 | await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') | 93 | for (const avatar of comment.account.avatars) { |
94 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') | ||
95 | } | ||
85 | 96 | ||
86 | expect(comment.totalReplies).to.equal(0) | 97 | expect(comment.totalReplies).to.equal(0) |
87 | expect(comment.totalRepliesFromVideoAuthor).to.equal(0) | 98 | expect(comment.totalRepliesFromVideoAuthor).to.equal(0) |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 34327334f..1e8dbef02 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -20,6 +20,7 @@ import { | |||
20 | PeerTubeServer, | 20 | PeerTubeServer, |
21 | PlaylistsCommand, | 21 | PlaylistsCommand, |
22 | setAccessTokensToServers, | 22 | setAccessTokensToServers, |
23 | setDefaultAccountAvatar, | ||
23 | setDefaultVideoChannel, | 24 | setDefaultVideoChannel, |
24 | waitJobs | 25 | waitJobs |
25 | } from '@shared/server-commands' | 26 | } from '@shared/server-commands' |
@@ -79,6 +80,7 @@ describe('Test video playlists', function () { | |||
79 | // Get the access tokens | 80 | // Get the access tokens |
80 | await setAccessTokensToServers(servers) | 81 | await setAccessTokensToServers(servers) |
81 | await setDefaultVideoChannel(servers) | 82 | await setDefaultVideoChannel(servers) |
83 | await setDefaultAccountAvatar(servers) | ||
82 | 84 | ||
83 | // Server 1 and server 2 follow each other | 85 | // Server 1 and server 2 follow each other |
84 | await doubleFollow(servers[0], servers[1]) | 86 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index 0254662c5..317de90a9 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts | |||
@@ -3,6 +3,7 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { pick } from '@shared/core-utils' | 5 | import { pick } from '@shared/core-utils' |
6 | import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' | ||
6 | import { | 7 | import { |
7 | cleanupTests, | 8 | cleanupTests, |
8 | createMultipleServers, | 9 | createMultipleServers, |
@@ -10,10 +11,10 @@ import { | |||
10 | makeGetRequest, | 11 | makeGetRequest, |
11 | PeerTubeServer, | 12 | PeerTubeServer, |
12 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | setDefaultAccountAvatar, | ||
13 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
14 | waitJobs | 16 | waitJobs |
15 | } from '@shared/server-commands' | 17 | } from '@shared/server-commands' |
16 | import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' | ||
17 | 18 | ||
18 | describe('Test videos filter', function () { | 19 | describe('Test videos filter', function () { |
19 | let servers: PeerTubeServer[] | 20 | let servers: PeerTubeServer[] |
@@ -29,6 +30,7 @@ describe('Test videos filter', function () { | |||
29 | 30 | ||
30 | await setAccessTokensToServers(servers) | 31 | await setAccessTokensToServers(servers) |
31 | await setDefaultVideoChannel(servers) | 32 | await setDefaultVideoChannel(servers) |
33 | await setDefaultAccountAvatar(servers) | ||
32 | 34 | ||
33 | for (const server of servers) { | 35 | for (const server of servers) { |
34 | const moderator = { username: 'moderator', password: 'my super password' } | 36 | const moderator = { username: 'moderator', password: 'my super password' } |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index a723ed8b4..3ca7c19ea 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -51,7 +51,7 @@ async function assertCountAreOkay (servers: PeerTubeServer[]) { | |||
51 | expect(thumbnailsCount).to.equal(6) | 51 | expect(thumbnailsCount).to.equal(6) |
52 | 52 | ||
53 | const avatarsCount = await countFiles(server, 'avatars') | 53 | const avatarsCount = await countFiles(server, 'avatars') |
54 | expect(avatarsCount).to.equal(2) | 54 | expect(avatarsCount).to.equal(4) |
55 | 55 | ||
56 | const hlsRootCount = await countFiles(server, 'streaming-playlists/hls') | 56 | const hlsRootCount = await countFiles(server, 'streaming-playlists/hls') |
57 | expect(hlsRootCount).to.equal(2) | 57 | expect(hlsRootCount).to.equal(2) |
@@ -87,23 +87,28 @@ describe('Test prune storage scripts', function () { | |||
87 | 87 | ||
88 | await doubleFollow(servers[0], servers[1]) | 88 | await doubleFollow(servers[0], servers[1]) |
89 | 89 | ||
90 | // Lazy load the remote avatar | 90 | // Lazy load the remote avatars |
91 | { | 91 | { |
92 | const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port }) | 92 | const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port }) |
93 | await makeGetRequest({ | 93 | |
94 | url: servers[0].url, | 94 | for (const avatar of account.avatars) { |
95 | path: account.avatar.path, | 95 | await makeGetRequest({ |
96 | expectedStatus: HttpStatusCode.OK_200 | 96 | url: servers[0].url, |
97 | }) | 97 | path: avatar.path, |
98 | expectedStatus: HttpStatusCode.OK_200 | ||
99 | }) | ||
100 | } | ||
98 | } | 101 | } |
99 | 102 | ||
100 | { | 103 | { |
101 | const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port }) | 104 | const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port }) |
102 | await makeGetRequest({ | 105 | for (const avatar of account.avatars) { |
103 | url: servers[1].url, | 106 | await makeGetRequest({ |
104 | path: account.avatar.path, | 107 | url: servers[1].url, |
105 | expectedStatus: HttpStatusCode.OK_200 | 108 | path: avatar.path, |
106 | }) | 109 | expectedStatus: HttpStatusCode.OK_200 |
110 | }) | ||
111 | } | ||
107 | } | 112 | } |
108 | 113 | ||
109 | await wait(1000) | 114 | await wait(1000) |
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 4dcd77cca..320dc3333 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts | |||
@@ -3,6 +3,7 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { XMLParser, XMLValidator } from 'fast-xml-parser' | 5 | import { XMLParser, XMLValidator } from 'fast-xml-parser' |
6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | ||
6 | import { | 7 | import { |
7 | cleanupTests, | 8 | cleanupTests, |
8 | createMultipleServers, | 9 | createMultipleServers, |
@@ -11,9 +12,9 @@ import { | |||
11 | makeGetRequest, | 12 | makeGetRequest, |
12 | PeerTubeServer, | 13 | PeerTubeServer, |
13 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | setDefaultChannelAvatar, | ||
14 | waitJobs | 16 | waitJobs |
15 | } from '@shared/server-commands' | 17 | } from '@shared/server-commands' |
16 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | ||
17 | 18 | ||
18 | chai.use(require('chai-xml')) | 19 | chai.use(require('chai-xml')) |
19 | chai.use(require('chai-json-schema')) | 20 | chai.use(require('chai-json-schema')) |
@@ -44,6 +45,7 @@ describe('Test syndication feeds', () => { | |||
44 | }) | 45 | }) |
45 | 46 | ||
46 | await setAccessTokensToServers([ ...servers, serverHLSOnly ]) | 47 | await setAccessTokensToServers([ ...servers, serverHLSOnly ]) |
48 | await setDefaultChannelAvatar(servers[0]) | ||
47 | await doubleFollow(servers[0], servers[1]) | 49 | await doubleFollow(servers[0], servers[1]) |
48 | 50 | ||
49 | { | 51 | { |
diff --git a/server/tests/fixtures/avatar-resized.gif b/server/tests/fixtures/avatar-resized-120x120.gif index 81a82189e..81a82189e 100644 --- a/server/tests/fixtures/avatar-resized.gif +++ b/server/tests/fixtures/avatar-resized-120x120.gif | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/avatar-resized.png b/server/tests/fixtures/avatar-resized-120x120.png index 9d84151f8..9d84151f8 100644 --- a/server/tests/fixtures/avatar-resized.png +++ b/server/tests/fixtures/avatar-resized-120x120.png | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/avatar-resized-48x48.gif b/server/tests/fixtures/avatar-resized-48x48.gif new file mode 100644 index 000000000..5900ff12e --- /dev/null +++ b/server/tests/fixtures/avatar-resized-48x48.gif | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/avatar-resized-48x48.png b/server/tests/fixtures/avatar-resized-48x48.png new file mode 100644 index 000000000..9e5f3b490 --- /dev/null +++ b/server/tests/fixtures/avatar-resized-48x48.png | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/avatar2-resized.png b/server/tests/fixtures/avatar2-resized-120x120.png index 44149facb..44149facb 100644 --- a/server/tests/fixtures/avatar2-resized.png +++ b/server/tests/fixtures/avatar2-resized-120x120.png | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/avatar2-resized-48x48.png b/server/tests/fixtures/avatar2-resized-48x48.png new file mode 100644 index 000000000..bb3939b1a --- /dev/null +++ b/server/tests/fixtures/avatar2-resized-48x48.png | |||
Binary files differ | |||
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts index cdc21fdc8..78d3787f0 100644 --- a/server/tests/shared/notifications.ts +++ b/server/tests/shared/notifications.ts | |||
@@ -10,7 +10,14 @@ import { | |||
10 | UserNotificationSettingValue, | 10 | UserNotificationSettingValue, |
11 | UserNotificationType | 11 | UserNotificationType |
12 | } from '@shared/models' | 12 | } from '@shared/models' |
13 | import { createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 13 | import { |
14 | createMultipleServers, | ||
15 | doubleFollow, | ||
16 | PeerTubeServer, | ||
17 | setAccessTokensToServers, | ||
18 | setDefaultAccountAvatar, | ||
19 | setDefaultChannelAvatar | ||
20 | } from '@shared/server-commands' | ||
14 | import { MockSmtpServer } from './mock-servers' | 21 | import { MockSmtpServer } from './mock-servers' |
15 | 22 | ||
16 | type CheckerBaseParams = { | 23 | type CheckerBaseParams = { |
@@ -646,6 +653,8 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an | |||
646 | const servers = await createMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg)) | 653 | const servers = await createMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg)) |
647 | 654 | ||
648 | await setAccessTokensToServers(servers) | 655 | await setAccessTokensToServers(servers) |
656 | await setDefaultChannelAvatar(servers) | ||
657 | await setDefaultAccountAvatar(servers) | ||
649 | 658 | ||
650 | if (serversCount > 1) { | 659 | if (serversCount > 1) { |
651 | await doubleFollow(servers[0], servers[1]) | 660 | await doubleFollow(servers[0], servers[1]) |