diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:04:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 89d241a79c262b9775c233b73cff080043ebb5e6 (patch) | |
tree | cb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/moderation/blocklist-notification.ts | |
parent | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff) | |
download | PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip |
Shorter server command names
Diffstat (limited to 'server/tests/api/moderation/blocklist-notification.ts')
-rw-r--r-- | server/tests/api/moderation/blocklist-notification.ts | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index 92a0ec681..6b56fdd65 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts | |||
@@ -8,7 +8,7 @@ import { UserNotificationType } from '@shared/models' | |||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { | 10 | async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { |
11 | const { data } = await server.notificationsCommand.list({ token, start: 0, count: 10, unread: true }) | 11 | const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true }) |
12 | expect(data).to.have.lengthOf(expected.length) | 12 | expect(data).to.have.lengthOf(expected.length) |
13 | 13 | ||
14 | for (const type of expected) { | 14 | for (const type of expected) { |
@@ -26,24 +26,24 @@ describe('Test blocklist', function () { | |||
26 | 26 | ||
27 | async function resetState () { | 27 | async function resetState () { |
28 | try { | 28 | try { |
29 | await servers[1].subscriptionsCommand.remove({ token: remoteUserToken, uri: 'user1_channel@' + servers[0].host }) | 29 | await servers[1].subscriptions.remove({ token: remoteUserToken, uri: 'user1_channel@' + servers[0].host }) |
30 | await servers[1].subscriptionsCommand.remove({ token: remoteUserToken, uri: 'user2_channel@' + servers[0].host }) | 30 | await servers[1].subscriptions.remove({ token: remoteUserToken, uri: 'user2_channel@' + servers[0].host }) |
31 | } catch {} | 31 | } catch {} |
32 | 32 | ||
33 | await waitJobs(servers) | 33 | await waitJobs(servers) |
34 | 34 | ||
35 | await servers[0].notificationsCommand.markAsReadAll({ token: userToken1 }) | 35 | await servers[0].notifications.markAsReadAll({ token: userToken1 }) |
36 | await servers[0].notificationsCommand.markAsReadAll({ token: userToken2 }) | 36 | await servers[0].notifications.markAsReadAll({ token: userToken2 }) |
37 | 37 | ||
38 | { | 38 | { |
39 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken1, attributes: { name: 'video' } }) | 39 | const { uuid } = await servers[0].videos.upload({ token: userToken1, attributes: { name: 'video' } }) |
40 | videoUUID = uuid | 40 | videoUUID = uuid |
41 | 41 | ||
42 | await waitJobs(servers) | 42 | await waitJobs(servers) |
43 | } | 43 | } |
44 | 44 | ||
45 | { | 45 | { |
46 | await servers[1].commentsCommand.createThread({ | 46 | await servers[1].comments.createThread({ |
47 | token: remoteUserToken, | 47 | token: remoteUserToken, |
48 | videoId: videoUUID, | 48 | videoId: videoUUID, |
49 | text: '@user2@' + servers[0].host + ' hello' | 49 | text: '@user2@' + servers[0].host + ' hello' |
@@ -52,8 +52,8 @@ describe('Test blocklist', function () { | |||
52 | 52 | ||
53 | { | 53 | { |
54 | 54 | ||
55 | await servers[1].subscriptionsCommand.add({ token: remoteUserToken, targetUri: 'user1_channel@' + servers[0].host }) | 55 | await servers[1].subscriptions.add({ token: remoteUserToken, targetUri: 'user1_channel@' + servers[0].host }) |
56 | await servers[1].subscriptionsCommand.add({ token: remoteUserToken, targetUri: 'user2_channel@' + servers[0].host }) | 56 | await servers[1].subscriptions.add({ token: remoteUserToken, targetUri: 'user2_channel@' + servers[0].host }) |
57 | } | 57 | } |
58 | 58 | ||
59 | await waitJobs(servers) | 59 | await waitJobs(servers) |
@@ -67,29 +67,29 @@ describe('Test blocklist', function () { | |||
67 | 67 | ||
68 | { | 68 | { |
69 | const user = { username: 'user1', password: 'password' } | 69 | const user = { username: 'user1', password: 'password' } |
70 | await servers[0].usersCommand.create({ | 70 | await servers[0].users.create({ |
71 | username: user.username, | 71 | username: user.username, |
72 | password: user.password, | 72 | password: user.password, |
73 | videoQuota: -1, | 73 | videoQuota: -1, |
74 | videoQuotaDaily: -1 | 74 | videoQuotaDaily: -1 |
75 | }) | 75 | }) |
76 | 76 | ||
77 | userToken1 = await servers[0].loginCommand.getAccessToken(user) | 77 | userToken1 = await servers[0].login.getAccessToken(user) |
78 | await servers[0].videosCommand.upload({ token: userToken1, attributes: { name: 'video user 1' } }) | 78 | await servers[0].videos.upload({ token: userToken1, attributes: { name: 'video user 1' } }) |
79 | } | 79 | } |
80 | 80 | ||
81 | { | 81 | { |
82 | const user = { username: 'user2', password: 'password' } | 82 | const user = { username: 'user2', password: 'password' } |
83 | await servers[0].usersCommand.create({ username: user.username, password: user.password }) | 83 | await servers[0].users.create({ username: user.username, password: user.password }) |
84 | 84 | ||
85 | userToken2 = await servers[0].loginCommand.getAccessToken(user) | 85 | userToken2 = await servers[0].login.getAccessToken(user) |
86 | } | 86 | } |
87 | 87 | ||
88 | { | 88 | { |
89 | const user = { username: 'user3', password: 'password' } | 89 | const user = { username: 'user3', password: 'password' } |
90 | await servers[1].usersCommand.create({ username: user.username, password: user.password }) | 90 | await servers[1].users.create({ username: user.username, password: user.password }) |
91 | 91 | ||
92 | remoteUserToken = await servers[1].loginCommand.getAccessToken(user) | 92 | remoteUserToken = await servers[1].login.getAccessToken(user) |
93 | } | 93 | } |
94 | 94 | ||
95 | await doubleFollow(servers[0], servers[1]) | 95 | await doubleFollow(servers[0], servers[1]) |
@@ -111,7 +111,7 @@ describe('Test blocklist', function () { | |||
111 | it('Should block an account', async function () { | 111 | it('Should block an account', async function () { |
112 | this.timeout(10000) | 112 | this.timeout(10000) |
113 | 113 | ||
114 | await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host }) | 114 | await servers[0].blocklist.addToMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host }) |
115 | await waitJobs(servers) | 115 | await waitJobs(servers) |
116 | }) | 116 | }) |
117 | 117 | ||
@@ -124,7 +124,7 @@ describe('Test blocklist', function () { | |||
124 | 124 | ||
125 | await checkNotifications(servers[0], userToken2, notifs) | 125 | await checkNotifications(servers[0], userToken2, notifs) |
126 | 126 | ||
127 | await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host }) | 127 | await servers[0].blocklist.removeFromMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host }) |
128 | }) | 128 | }) |
129 | }) | 129 | }) |
130 | 130 | ||
@@ -144,7 +144,7 @@ describe('Test blocklist', function () { | |||
144 | it('Should block an account', async function () { | 144 | it('Should block an account', async function () { |
145 | this.timeout(10000) | 145 | this.timeout(10000) |
146 | 146 | ||
147 | await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, server: servers[1].host }) | 147 | await servers[0].blocklist.addToMyBlocklist({ token: userToken1, server: servers[1].host }) |
148 | await waitJobs(servers) | 148 | await waitJobs(servers) |
149 | }) | 149 | }) |
150 | 150 | ||
@@ -157,7 +157,7 @@ describe('Test blocklist', function () { | |||
157 | 157 | ||
158 | await checkNotifications(servers[0], userToken2, notifs) | 158 | await checkNotifications(servers[0], userToken2, notifs) |
159 | 159 | ||
160 | await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, server: servers[1].host }) | 160 | await servers[0].blocklist.removeFromMyBlocklist({ token: userToken1, server: servers[1].host }) |
161 | }) | 161 | }) |
162 | }) | 162 | }) |
163 | 163 | ||
@@ -184,7 +184,7 @@ describe('Test blocklist', function () { | |||
184 | it('Should block an account', async function () { | 184 | it('Should block an account', async function () { |
185 | this.timeout(10000) | 185 | this.timeout(10000) |
186 | 186 | ||
187 | await servers[0].blocklistCommand.addToServerBlocklist({ account: 'user3@' + servers[1].host }) | 187 | await servers[0].blocklist.addToServerBlocklist({ account: 'user3@' + servers[1].host }) |
188 | await waitJobs(servers) | 188 | await waitJobs(servers) |
189 | }) | 189 | }) |
190 | 190 | ||
@@ -192,7 +192,7 @@ describe('Test blocklist', function () { | |||
192 | await checkNotifications(servers[0], userToken1, []) | 192 | await checkNotifications(servers[0], userToken1, []) |
193 | await checkNotifications(servers[0], userToken2, []) | 193 | await checkNotifications(servers[0], userToken2, []) |
194 | 194 | ||
195 | await servers[0].blocklistCommand.removeFromServerBlocklist({ account: 'user3@' + servers[1].host }) | 195 | await servers[0].blocklist.removeFromServerBlocklist({ account: 'user3@' + servers[1].host }) |
196 | }) | 196 | }) |
197 | }) | 197 | }) |
198 | 198 | ||
@@ -219,7 +219,7 @@ describe('Test blocklist', function () { | |||
219 | it('Should block an account', async function () { | 219 | it('Should block an account', async function () { |
220 | this.timeout(10000) | 220 | this.timeout(10000) |
221 | 221 | ||
222 | await servers[0].blocklistCommand.addToServerBlocklist({ server: servers[1].host }) | 222 | await servers[0].blocklist.addToServerBlocklist({ server: servers[1].host }) |
223 | await waitJobs(servers) | 223 | await waitJobs(servers) |
224 | }) | 224 | }) |
225 | 225 | ||