aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/moderation/blocklist-notification.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 16:02:46 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c (patch)
tree02d056121540652b0867fc2ef56699138afe6271 /server/tests/api/moderation/blocklist-notification.ts
parent9fff08cf83f34339df7ed4ac770e1dee536adf9d (diff)
downloadPeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.tar.gz
PeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.tar.zst
PeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.zip
Introduce blocklist command
Diffstat (limited to 'server/tests/api/moderation/blocklist-notification.ts')
-rw-r--r--server/tests/api/moderation/blocklist-notification.ts41
1 files changed, 17 insertions, 24 deletions
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index 4fb3c95f2..99da64a2d 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -2,30 +2,23 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { getUserNotifications, markAsReadAllNotifications } from '@shared/extra-utils/users/user-notifications'
6import { addUserSubscription, removeUserSubscription } from '@shared/extra-utils/users/user-subscriptions'
7import { UserNotification, UserNotificationType } from '@shared/models'
8import { 5import {
6 addUserSubscription,
7 addVideoCommentThread,
9 cleanupTests, 8 cleanupTests,
10 createUser, 9 createUser,
11 doubleFollow, 10 doubleFollow,
12 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
12 getUserNotifications,
13 markAsReadAllNotifications,
14 removeUserSubscription,
13 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers,
14 uploadVideo, 17 uploadVideo,
15 userLogin 18 userLogin,
16} from '../../../../shared/extra-utils/index' 19 waitJobs
17import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 20} from '@shared/extra-utils'
18import { 21import { UserNotification, UserNotificationType } from '@shared/models'
19 addAccountToAccountBlocklist,
20 addAccountToServerBlocklist,
21 addServerToAccountBlocklist,
22 addServerToServerBlocklist,
23 removeAccountFromAccountBlocklist,
24 removeAccountFromServerBlocklist,
25 removeServerFromAccountBlocklist
26} from '../../../../shared/extra-utils/users/blocklist'
27import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
28import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
29 22
30const expect = chai.expect 23const expect = chai.expect
31 24
@@ -134,7 +127,7 @@ describe('Test blocklist', function () {
134 it('Should block an account', async function () { 127 it('Should block an account', async function () {
135 this.timeout(10000) 128 this.timeout(10000)
136 129
137 await addAccountToAccountBlocklist(servers[0].url, userToken1, 'user3@' + servers[1].host) 130 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host })
138 await waitJobs(servers) 131 await waitJobs(servers)
139 }) 132 })
140 133
@@ -147,7 +140,7 @@ describe('Test blocklist', function () {
147 140
148 await checkNotifications(servers[0].url, userToken2, notifs) 141 await checkNotifications(servers[0].url, userToken2, notifs)
149 142
150 await removeAccountFromAccountBlocklist(servers[0].url, userToken1, 'user3@' + servers[1].host) 143 await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host })
151 }) 144 })
152 }) 145 })
153 146
@@ -167,7 +160,7 @@ describe('Test blocklist', function () {
167 it('Should block an account', async function () { 160 it('Should block an account', async function () {
168 this.timeout(10000) 161 this.timeout(10000)
169 162
170 await addServerToAccountBlocklist(servers[0].url, userToken1, servers[1].host) 163 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, server: servers[1].host })
171 await waitJobs(servers) 164 await waitJobs(servers)
172 }) 165 })
173 166
@@ -180,7 +173,7 @@ describe('Test blocklist', function () {
180 173
181 await checkNotifications(servers[0].url, userToken2, notifs) 174 await checkNotifications(servers[0].url, userToken2, notifs)
182 175
183 await removeServerFromAccountBlocklist(servers[0].url, userToken1, servers[1].host) 176 await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, server: servers[1].host })
184 }) 177 })
185 }) 178 })
186 179
@@ -207,7 +200,7 @@ describe('Test blocklist', function () {
207 it('Should block an account', async function () { 200 it('Should block an account', async function () {
208 this.timeout(10000) 201 this.timeout(10000)
209 202
210 await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'user3@' + servers[1].host) 203 await servers[0].blocklistCommand.addToServerBlocklist({ account: 'user3@' + servers[1].host })
211 await waitJobs(servers) 204 await waitJobs(servers)
212 }) 205 })
213 206
@@ -215,7 +208,7 @@ describe('Test blocklist', function () {
215 await checkNotifications(servers[0].url, userToken1, []) 208 await checkNotifications(servers[0].url, userToken1, [])
216 await checkNotifications(servers[0].url, userToken2, []) 209 await checkNotifications(servers[0].url, userToken2, [])
217 210
218 await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'user3@' + servers[1].host) 211 await servers[0].blocklistCommand.removeFromServerBlocklist({ account: 'user3@' + servers[1].host })
219 }) 212 })
220 }) 213 })
221 214
@@ -242,7 +235,7 @@ describe('Test blocklist', function () {
242 it('Should block an account', async function () { 235 it('Should block an account', async function () {
243 this.timeout(10000) 236 this.timeout(10000)
244 237
245 await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, servers[1].host) 238 await servers[0].blocklistCommand.addToServerBlocklist({ server: servers[1].host })
246 await waitJobs(servers) 239 await waitJobs(servers)
247 }) 240 })
248 241