diff options
author | Josh Morel <morel.josh@hotmail.com> | 2019-04-02 05:26:47 -0400 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-04-02 11:26:47 +0200 |
commit | 7ccddd7b5250bd25a917a6e77e58b87b9484a2a4 (patch) | |
tree | e75dc991369c1768804fefa114eb2a832881087f /server/tests/api | |
parent | 12fed49ebab0c414713d57ea316b6488ae6bef99 (diff) | |
download | PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.tar.gz PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.tar.zst PeerTube-7ccddd7b5250bd25a917a6e77e58b87b9484a2a4.zip |
add quarantine videos feature (#1637)
* add quarantine videos feature
* increase Notification settings test timeout
to 20000ms. was completing 7000 locally but timing out
after 10000 on travis
* fix quarantine video test issues
-propagate misspelling
-remove skip from server/tests/client.ts
* WIP use blacklist for moderator video approval
instead of video.quarantine boolean
* finish auto-blacklist feature
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/config.ts | 7 | ||||
-rw-r--r-- | server/tests/api/check-params/user-notifications.ts | 1 | ||||
-rw-r--r-- | server/tests/api/check-params/video-blacklist.ts | 11 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.ts | 3 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 9 | ||||
-rw-r--r-- | server/tests/api/users/user-notifications.ts | 191 | ||||
-rw-r--r-- | server/tests/api/videos/video-blacklist.ts | 25 |
7 files changed, 237 insertions, 10 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index c6b460f23..0b333e2f4 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -80,6 +80,13 @@ describe('Test config API validators', function () { | |||
80 | enabled: false | 80 | enabled: false |
81 | } | 81 | } |
82 | } | 82 | } |
83 | }, | ||
84 | autoBlacklist: { | ||
85 | videos: { | ||
86 | ofUsers: { | ||
87 | enabled: false | ||
88 | } | ||
89 | } | ||
83 | } | 90 | } |
84 | } | 91 | } |
85 | 92 | ||
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 714f481e9..36eaceac7 100644 --- a/server/tests/api/check-params/user-notifications.ts +++ b/server/tests/api/check-params/user-notifications.ts | |||
@@ -168,6 +168,7 @@ describe('Test user notifications API validators', function () { | |||
168 | newVideoFromSubscription: UserNotificationSettingValue.WEB, | 168 | newVideoFromSubscription: UserNotificationSettingValue.WEB, |
169 | newCommentOnMyVideo: UserNotificationSettingValue.WEB, | 169 | newCommentOnMyVideo: UserNotificationSettingValue.WEB, |
170 | videoAbuseAsModerator: UserNotificationSettingValue.WEB, | 170 | videoAbuseAsModerator: UserNotificationSettingValue.WEB, |
171 | videoAutoBlacklistAsModerator: UserNotificationSettingValue.WEB, | ||
171 | blacklistOnMyVideo: UserNotificationSettingValue.WEB, | 172 | blacklistOnMyVideo: UserNotificationSettingValue.WEB, |
172 | myVideoImportFinished: UserNotificationSettingValue.WEB, | 173 | myVideoImportFinished: UserNotificationSettingValue.WEB, |
173 | myVideoPublished: UserNotificationSettingValue.WEB, | 174 | myVideoPublished: UserNotificationSettingValue.WEB, |
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 6b82643f4..fc039e847 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts | |||
@@ -8,6 +8,7 @@ import { | |||
8 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
9 | flushTests, | 9 | flushTests, |
10 | getBlacklistedVideosList, | 10 | getBlacklistedVideosList, |
11 | getBlacklistedVideosListWithTypeFilter, | ||
11 | getVideo, | 12 | getVideo, |
12 | getVideoWithToken, | 13 | getVideoWithToken, |
13 | killallServers, | 14 | killallServers, |
@@ -24,7 +25,7 @@ import { | |||
24 | checkBadSortPagination, | 25 | checkBadSortPagination, |
25 | checkBadStartPagination | 26 | checkBadStartPagination |
26 | } from '../../../../shared/utils/requests/check-api-params' | 27 | } from '../../../../shared/utils/requests/check-api-params' |
27 | import { VideoDetails } from '../../../../shared/models/videos' | 28 | import { VideoDetails, VideoBlacklistType } from '../../../../shared/models/videos' |
28 | import { expect } from 'chai' | 29 | import { expect } from 'chai' |
29 | 30 | ||
30 | describe('Test video blacklist API validators', function () { | 31 | describe('Test video blacklist API validators', function () { |
@@ -238,6 +239,14 @@ describe('Test video blacklist API validators', function () { | |||
238 | it('Should fail with an incorrect sort', async function () { | 239 | it('Should fail with an incorrect sort', async function () { |
239 | await checkBadSortPagination(servers[0].url, basePath, servers[0].accessToken) | 240 | await checkBadSortPagination(servers[0].url, basePath, servers[0].accessToken) |
240 | }) | 241 | }) |
242 | |||
243 | it('Should fail with an invalid type', async function () { | ||
244 | await getBlacklistedVideosListWithTypeFilter(servers[0].url, servers[0].accessToken, 0, 400) | ||
245 | }) | ||
246 | |||
247 | it('Should succeed with the correct parameters', async function () { | ||
248 | await getBlacklistedVideosListWithTypeFilter(servers[0].url, servers[0].accessToken, VideoBlacklistType.MANUAL) | ||
249 | }) | ||
241 | }) | 250 | }) |
242 | 251 | ||
243 | after(async function () { | 252 | after(async function () { |
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 3eccaee44..5a013b890 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -7,7 +7,8 @@ import { join } from 'path' | |||
7 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | 7 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' |
8 | import { | 8 | import { |
9 | createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, | 9 | createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, |
10 | makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin | 10 | makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo, |
11 | runServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig | ||
11 | } from '../../../../shared/utils' | 12 | } from '../../../../shared/utils' |
12 | import { | 13 | import { |
13 | checkBadCountPagination, | 14 | checkBadCountPagination, |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 42927605d..b9f05e952 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -62,6 +62,7 @@ function checkInitialConfig (data: CustomConfig) { | |||
62 | 62 | ||
63 | expect(data.import.videos.http.enabled).to.be.true | 63 | expect(data.import.videos.http.enabled).to.be.true |
64 | expect(data.import.videos.torrent.enabled).to.be.true | 64 | expect(data.import.videos.torrent.enabled).to.be.true |
65 | expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.false | ||
65 | } | 66 | } |
66 | 67 | ||
67 | function checkUpdatedConfig (data: CustomConfig) { | 68 | function checkUpdatedConfig (data: CustomConfig) { |
@@ -103,6 +104,7 @@ function checkUpdatedConfig (data: CustomConfig) { | |||
103 | 104 | ||
104 | expect(data.import.videos.http.enabled).to.be.false | 105 | expect(data.import.videos.http.enabled).to.be.false |
105 | expect(data.import.videos.torrent.enabled).to.be.false | 106 | expect(data.import.videos.torrent.enabled).to.be.false |
107 | expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.true | ||
106 | } | 108 | } |
107 | 109 | ||
108 | describe('Test config', function () { | 110 | describe('Test config', function () { |
@@ -225,6 +227,13 @@ describe('Test config', function () { | |||
225 | enabled: false | 227 | enabled: false |
226 | } | 228 | } |
227 | } | 229 | } |
230 | }, | ||
231 | autoBlacklist: { | ||
232 | videos: { | ||
233 | ofUsers: { | ||
234 | enabled: true | ||
235 | } | ||
236 | } | ||
228 | } | 237 | } |
229 | } | 238 | } |
230 | await updateCustomConfig(server.url, server.accessToken, newCustomConfig) | 239 | await updateCustomConfig(server.url, server.accessToken, newCustomConfig) |
diff --git a/server/tests/api/users/user-notifications.ts b/server/tests/api/users/user-notifications.ts index d573bf024..1b66df79b 100644 --- a/server/tests/api/users/user-notifications.ts +++ b/server/tests/api/users/user-notifications.ts | |||
@@ -17,7 +17,9 @@ import { | |||
17 | updateVideo, | 17 | updateVideo, |
18 | updateVideoChannel, | 18 | updateVideoChannel, |
19 | userLogin, | 19 | userLogin, |
20 | wait | 20 | wait, |
21 | getCustomConfig, | ||
22 | updateCustomConfig | ||
21 | } from '../../../../shared/utils' | 23 | } from '../../../../shared/utils' |
22 | import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index' | 24 | import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index' |
23 | import { setAccessTokensToServers } from '../../../../shared/utils/users/login' | 25 | import { setAccessTokensToServers } from '../../../../shared/utils/users/login' |
@@ -31,6 +33,7 @@ import { | |||
31 | checkNewBlacklistOnMyVideo, | 33 | checkNewBlacklistOnMyVideo, |
32 | checkNewCommentOnMyVideo, | 34 | checkNewCommentOnMyVideo, |
33 | checkNewVideoAbuseForModerators, | 35 | checkNewVideoAbuseForModerators, |
36 | checkVideoAutoBlacklistForModerators, | ||
34 | checkNewVideoFromSubscription, | 37 | checkNewVideoFromSubscription, |
35 | checkUserRegistered, | 38 | checkUserRegistered, |
36 | checkVideoIsPublished, | 39 | checkVideoIsPublished, |
@@ -54,6 +57,7 @@ import { getBadVideoUrl, getYoutubeVideoUrl, importVideo } from '../../../../sha | |||
54 | import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/utils/videos/video-comments' | 57 | import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/utils/videos/video-comments' |
55 | import * as uuidv4 from 'uuid/v4' | 58 | import * as uuidv4 from 'uuid/v4' |
56 | import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/utils/users/blocklist' | 59 | import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/utils/users/blocklist' |
60 | import { CustomConfig } from '../../../../shared/models/server' | ||
57 | 61 | ||
58 | const expect = chai.expect | 62 | const expect = chai.expect |
59 | 63 | ||
@@ -92,6 +96,7 @@ describe('Test users notifications', function () { | |||
92 | newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 96 | newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
93 | newCommentOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 97 | newCommentOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
94 | videoAbuseAsModerator: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 98 | videoAbuseAsModerator: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
99 | videoAutoBlacklistAsModerator: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | ||
95 | blacklistOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 100 | blacklistOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
96 | myVideoImportFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 101 | myVideoImportFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
97 | myVideoPublished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 102 | myVideoPublished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
@@ -305,7 +310,7 @@ describe('Test users notifications', function () { | |||
305 | }) | 310 | }) |
306 | 311 | ||
307 | it('Should send a new video notification after a video import', async function () { | 312 | it('Should send a new video notification after a video import', async function () { |
308 | this.timeout(30000) | 313 | this.timeout(100000) |
309 | 314 | ||
310 | const name = 'video import ' + uuidv4() | 315 | const name = 'video import ' + uuidv4() |
311 | 316 | ||
@@ -907,6 +912,180 @@ describe('Test users notifications', function () { | |||
907 | }) | 912 | }) |
908 | }) | 913 | }) |
909 | 914 | ||
915 | describe('Video-related notifications when video auto-blacklist is enabled', function () { | ||
916 | let userBaseParams: CheckerBaseParams | ||
917 | let adminBaseParamsServer1: CheckerBaseParams | ||
918 | let adminBaseParamsServer2: CheckerBaseParams | ||
919 | let videoUUID: string | ||
920 | let videoName: string | ||
921 | let currentCustomConfig: CustomConfig | ||
922 | |||
923 | before(async () => { | ||
924 | |||
925 | adminBaseParamsServer1 = { | ||
926 | server: servers[0], | ||
927 | emails, | ||
928 | socketNotifications: adminNotifications, | ||
929 | token: servers[0].accessToken | ||
930 | } | ||
931 | |||
932 | adminBaseParamsServer2 = { | ||
933 | server: servers[1], | ||
934 | emails, | ||
935 | socketNotifications: adminNotificationsServer2, | ||
936 | token: servers[1].accessToken | ||
937 | } | ||
938 | |||
939 | userBaseParams = { | ||
940 | server: servers[0], | ||
941 | emails, | ||
942 | socketNotifications: userNotifications, | ||
943 | token: userAccessToken | ||
944 | } | ||
945 | |||
946 | const resCustomConfig = await getCustomConfig(servers[0].url, servers[0].accessToken) | ||
947 | currentCustomConfig = resCustomConfig.body | ||
948 | const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, { | ||
949 | autoBlacklist: { | ||
950 | videos: { | ||
951 | ofUsers: { | ||
952 | enabled: true | ||
953 | } | ||
954 | } | ||
955 | } | ||
956 | }) | ||
957 | // enable transcoding otherwise own publish notification after transcoding not expected | ||
958 | autoBlacklistTestsCustomConfig.transcoding.enabled = true | ||
959 | await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig) | ||
960 | |||
961 | await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') | ||
962 | await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') | ||
963 | |||
964 | }) | ||
965 | |||
966 | it('Should send notification to moderators on new video with auto-blacklist', async function () { | ||
967 | this.timeout(20000) | ||
968 | |||
969 | videoName = 'video with auto-blacklist ' + uuidv4() | ||
970 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName }) | ||
971 | videoUUID = resVideo.body.video.uuid | ||
972 | |||
973 | await waitJobs(servers) | ||
974 | await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, videoUUID, videoName, 'presence') | ||
975 | }) | ||
976 | |||
977 | it('Should not send video publish notification if auto-blacklisted', async function () { | ||
978 | await checkVideoIsPublished(userBaseParams, videoName, videoUUID, 'absence') | ||
979 | }) | ||
980 | |||
981 | it('Should not send a local user subscription notification if auto-blacklisted', async function () { | ||
982 | await checkNewVideoFromSubscription(adminBaseParamsServer1, videoName, videoUUID, 'absence') | ||
983 | }) | ||
984 | |||
985 | it('Should not send a remote user subscription notification if auto-blacklisted', async function () { | ||
986 | await checkNewVideoFromSubscription(adminBaseParamsServer2, videoName, videoUUID, 'absence') | ||
987 | }) | ||
988 | |||
989 | it('Should send video published and unblacklist after video unblacklisted', async function () { | ||
990 | this.timeout(20000) | ||
991 | |||
992 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoUUID) | ||
993 | |||
994 | await waitJobs(servers) | ||
995 | |||
996 | // FIXME: Can't test as two notifications sent to same user and util only checks last one | ||
997 | // One notification might be better anyways | ||
998 | // await checkNewBlacklistOnMyVideo(userBaseParams, videoUUID, videoName, 'unblacklist') | ||
999 | // await checkVideoIsPublished(userBaseParams, videoName, videoUUID, 'presence') | ||
1000 | }) | ||
1001 | |||
1002 | it('Should send a local user subscription notification after removed from blacklist', async function () { | ||
1003 | await checkNewVideoFromSubscription(adminBaseParamsServer1, videoName, videoUUID, 'presence') | ||
1004 | }) | ||
1005 | |||
1006 | it('Should send a remote user subscription notification after removed from blacklist', async function () { | ||
1007 | await checkNewVideoFromSubscription(adminBaseParamsServer2, videoName, videoUUID, 'presence') | ||
1008 | }) | ||
1009 | |||
1010 | it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () { | ||
1011 | this.timeout(20000) | ||
1012 | |||
1013 | let updateAt = new Date(new Date().getTime() + 100000) | ||
1014 | |||
1015 | const name = 'video with auto-blacklist and future schedule ' + uuidv4() | ||
1016 | |||
1017 | const data = { | ||
1018 | name, | ||
1019 | privacy: VideoPrivacy.PRIVATE, | ||
1020 | scheduleUpdate: { | ||
1021 | updateAt: updateAt.toISOString(), | ||
1022 | privacy: VideoPrivacy.PUBLIC | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, data) | ||
1027 | const uuid = resVideo.body.video.uuid | ||
1028 | |||
1029 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, uuid) | ||
1030 | |||
1031 | await waitJobs(servers) | ||
1032 | await checkNewBlacklistOnMyVideo(userBaseParams, uuid, name, 'unblacklist') | ||
1033 | |||
1034 | // FIXME: Can't test absence as two notifications sent to same user and util only checks last one | ||
1035 | // One notification might be better anyways | ||
1036 | // await checkVideoIsPublished(userBaseParams, name, uuid, 'absence') | ||
1037 | |||
1038 | await checkNewVideoFromSubscription(adminBaseParamsServer1, name, uuid, 'absence') | ||
1039 | await checkNewVideoFromSubscription(adminBaseParamsServer2, name, uuid, 'absence') | ||
1040 | }) | ||
1041 | |||
1042 | it('Should not send publish/subscription notifications after scheduled update if video still auto-blacklisted', async function () { | ||
1043 | this.timeout(20000) | ||
1044 | |||
1045 | // In 2 seconds | ||
1046 | let updateAt = new Date(new Date().getTime() + 2000) | ||
1047 | |||
1048 | const name = 'video with schedule done and still auto-blacklisted ' + uuidv4() | ||
1049 | |||
1050 | const data = { | ||
1051 | name, | ||
1052 | privacy: VideoPrivacy.PRIVATE, | ||
1053 | scheduleUpdate: { | ||
1054 | updateAt: updateAt.toISOString(), | ||
1055 | privacy: VideoPrivacy.PUBLIC | ||
1056 | } | ||
1057 | } | ||
1058 | |||
1059 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, data) | ||
1060 | const uuid = resVideo.body.video.uuid | ||
1061 | |||
1062 | await wait(6000) | ||
1063 | await checkVideoIsPublished(userBaseParams, name, uuid, 'absence') | ||
1064 | await checkNewVideoFromSubscription(adminBaseParamsServer1, name, uuid, 'absence') | ||
1065 | await checkNewVideoFromSubscription(adminBaseParamsServer2, name, uuid, 'absence') | ||
1066 | }) | ||
1067 | |||
1068 | it('Should not send a notification to moderators on new video without auto-blacklist', async function () { | ||
1069 | this.timeout(20000) | ||
1070 | |||
1071 | const name = 'video without auto-blacklist ' + uuidv4() | ||
1072 | |||
1073 | // admin with blacklist right will not be auto-blacklisted | ||
1074 | const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name }) | ||
1075 | const uuid = resVideo.body.video.uuid | ||
1076 | |||
1077 | await waitJobs(servers) | ||
1078 | await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, uuid, name, 'absence') | ||
1079 | }) | ||
1080 | |||
1081 | after(async () => { | ||
1082 | await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig) | ||
1083 | |||
1084 | await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') | ||
1085 | await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') | ||
1086 | }) | ||
1087 | }) | ||
1088 | |||
910 | describe('Mark as read', function () { | 1089 | describe('Mark as read', function () { |
911 | it('Should mark as read some notifications', async function () { | 1090 | it('Should mark as read some notifications', async function () { |
912 | const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 2, 3) | 1091 | const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 2, 3) |
@@ -968,7 +1147,7 @@ describe('Test users notifications', function () { | |||
968 | }) | 1147 | }) |
969 | 1148 | ||
970 | it('Should not have notifications', async function () { | 1149 | it('Should not have notifications', async function () { |
971 | this.timeout(10000) | 1150 | this.timeout(20000) |
972 | 1151 | ||
973 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { | 1152 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { |
974 | newVideoFromSubscription: UserNotificationSettingValue.NONE | 1153 | newVideoFromSubscription: UserNotificationSettingValue.NONE |
@@ -987,7 +1166,7 @@ describe('Test users notifications', function () { | |||
987 | }) | 1166 | }) |
988 | 1167 | ||
989 | it('Should only have web notifications', async function () { | 1168 | it('Should only have web notifications', async function () { |
990 | this.timeout(10000) | 1169 | this.timeout(20000) |
991 | 1170 | ||
992 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { | 1171 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { |
993 | newVideoFromSubscription: UserNotificationSettingValue.WEB | 1172 | newVideoFromSubscription: UserNotificationSettingValue.WEB |
@@ -1013,7 +1192,7 @@ describe('Test users notifications', function () { | |||
1013 | }) | 1192 | }) |
1014 | 1193 | ||
1015 | it('Should only have mail notifications', async function () { | 1194 | it('Should only have mail notifications', async function () { |
1016 | this.timeout(10000) | 1195 | this.timeout(20000) |
1017 | 1196 | ||
1018 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { | 1197 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { |
1019 | newVideoFromSubscription: UserNotificationSettingValue.EMAIL | 1198 | newVideoFromSubscription: UserNotificationSettingValue.EMAIL |
@@ -1039,7 +1218,7 @@ describe('Test users notifications', function () { | |||
1039 | }) | 1218 | }) |
1040 | 1219 | ||
1041 | it('Should have email and web notifications', async function () { | 1220 | it('Should have email and web notifications', async function () { |
1042 | this.timeout(10000) | 1221 | this.timeout(20000) |
1043 | 1222 | ||
1044 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { | 1223 | await updateMyNotificationSettings(servers[0].url, userAccessToken, immutableAssign(allNotificationSettings, { |
1045 | newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL | 1224 | newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL |
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts index d39ad63b4..10b412a80 100644 --- a/server/tests/api/videos/video-blacklist.ts +++ b/server/tests/api/videos/video-blacklist.ts | |||
@@ -7,6 +7,7 @@ import { | |||
7 | addVideoToBlacklist, | 7 | addVideoToBlacklist, |
8 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
9 | getBlacklistedVideosList, | 9 | getBlacklistedVideosList, |
10 | getBlacklistedVideosListWithTypeFilter, | ||
10 | getMyVideos, | 11 | getMyVideos, |
11 | getSortedBlacklistedVideosList, | 12 | getSortedBlacklistedVideosList, |
12 | getVideosList, | 13 | getVideosList, |
@@ -22,7 +23,7 @@ import { | |||
22 | } from '../../../../shared/utils/index' | 23 | } from '../../../../shared/utils/index' |
23 | import { doubleFollow } from '../../../../shared/utils/server/follows' | 24 | import { doubleFollow } from '../../../../shared/utils/server/follows' |
24 | import { waitJobs } from '../../../../shared/utils/server/jobs' | 25 | import { waitJobs } from '../../../../shared/utils/server/jobs' |
25 | import { VideoBlacklist } from '../../../../shared/models/videos' | 26 | import { VideoBlacklist, VideoBlacklistType } from '../../../../shared/models/videos' |
26 | 27 | ||
27 | const expect = chai.expect | 28 | const expect = chai.expect |
28 | 29 | ||
@@ -101,7 +102,7 @@ describe('Test video blacklist management', function () { | |||
101 | }) | 102 | }) |
102 | }) | 103 | }) |
103 | 104 | ||
104 | describe('When listing blacklisted videos', function () { | 105 | describe('When listing manually blacklisted videos', function () { |
105 | it('Should display all the blacklisted videos', async function () { | 106 | it('Should display all the blacklisted videos', async function () { |
106 | const res = await getBlacklistedVideosList(servers[0].url, servers[0].accessToken) | 107 | const res = await getBlacklistedVideosList(servers[0].url, servers[0].accessToken) |
107 | 108 | ||
@@ -117,6 +118,26 @@ describe('Test video blacklist management', function () { | |||
117 | } | 118 | } |
118 | }) | 119 | }) |
119 | 120 | ||
121 | it('Should display all the blacklisted videos when applying manual type filter', async function () { | ||
122 | const res = await getBlacklistedVideosListWithTypeFilter(servers[0].url, servers[0].accessToken, VideoBlacklistType.MANUAL) | ||
123 | |||
124 | expect(res.body.total).to.equal(2) | ||
125 | |||
126 | const blacklistedVideos = res.body.data | ||
127 | expect(blacklistedVideos).to.be.an('array') | ||
128 | expect(blacklistedVideos.length).to.equal(2) | ||
129 | }) | ||
130 | |||
131 | it('Should display nothing when applying automatic type filter', async function () { | ||
132 | const res = await getBlacklistedVideosListWithTypeFilter(servers[0].url, servers[0].accessToken, VideoBlacklistType.AUTO_BEFORE_PUBLISHED) // tslint:disable:max-line-length | ||
133 | |||
134 | expect(res.body.total).to.equal(0) | ||
135 | |||
136 | const blacklistedVideos = res.body.data | ||
137 | expect(blacklistedVideos).to.be.an('array') | ||
138 | expect(blacklistedVideos.length).to.equal(0) | ||
139 | }) | ||
140 | |||
120 | it('Should get the correct sort when sorting by descending id', async function () { | 141 | it('Should get the correct sort when sorting by descending id', async function () { |
121 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-id') | 142 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-id') |
122 | expect(res.body.total).to.equal(2) | 143 | expect(res.body.total).to.equal(2) |