aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-12 17:26:40 +0200
committerChocobozzz <me@florianbigard.com>2018-10-16 16:41:36 +0200
commitaf5767ffae41b2d5604e41ba9a7225c623dd6735 (patch)
treeb96787bd134fe04d3d042795636df4bf17b5991f /server/tests/api
parent7ad9b9846c44d198a736183fb186c2039f5236b5 (diff)
downloadPeerTube-af5767ffae41b2d5604e41ba9a7225c623dd6735.tar.gz
PeerTube-af5767ffae41b2d5604e41ba9a7225c623dd6735.tar.zst
PeerTube-af5767ffae41b2d5604e41ba9a7225c623dd6735.zip
Add user/instance block by users in the client
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/blocklist.ts20
-rw-r--r--server/tests/api/users/account-blocklist.ts14
2 files changed, 27 insertions, 7 deletions
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index 8117c46a6..d24d9323f 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -85,6 +85,16 @@ describe('Test blocklist API validators', function () {
85 }) 85 })
86 }) 86 })
87 87
88 it('Should fail to block ourselves', async function () {
89 await makePostBodyRequest({
90 url: server.url,
91 token: server.accessToken,
92 path,
93 fields: { accountName: 'root' },
94 statusCodeExpected: 409
95 })
96 })
97
88 it('Should succeed with the correct params', async function () { 98 it('Should succeed with the correct params', async function () {
89 await makePostBodyRequest({ 99 await makePostBodyRequest({
90 url: server.url, 100 url: server.url,
@@ -170,6 +180,16 @@ describe('Test blocklist API validators', function () {
170 }) 180 })
171 }) 181 })
172 182
183 it('Should fail with our own server', async function () {
184 await makePostBodyRequest({
185 url: server.url,
186 token: server.accessToken,
187 path,
188 fields: { host: 'localhost:9001' },
189 statusCodeExpected: 409
190 })
191 })
192
173 it('Should succeed with the correct params', async function () { 193 it('Should succeed with the correct params', async function () {
174 await makePostBodyRequest({ 194 await makePostBodyRequest({
175 url: server.url, 195 url: server.url,
diff --git a/server/tests/api/users/account-blocklist.ts b/server/tests/api/users/account-blocklist.ts
index 00ad51461..026971331 100644
--- a/server/tests/api/users/account-blocklist.ts
+++ b/server/tests/api/users/account-blocklist.ts
@@ -183,9 +183,9 @@ describe('Test accounts blocklist', function () {
183 const block = blocks[0] 183 const block = blocks[0]
184 expect(block.byAccount.displayName).to.equal('root') 184 expect(block.byAccount.displayName).to.equal('root')
185 expect(block.byAccount.name).to.equal('root') 185 expect(block.byAccount.name).to.equal('root')
186 expect(block.accountBlocked.displayName).to.equal('user2') 186 expect(block.blockedAccount.displayName).to.equal('user2')
187 expect(block.accountBlocked.name).to.equal('user2') 187 expect(block.blockedAccount.name).to.equal('user2')
188 expect(block.accountBlocked.host).to.equal('localhost:9002') 188 expect(block.blockedAccount.host).to.equal('localhost:9002')
189 } 189 }
190 190
191 { 191 {
@@ -197,9 +197,9 @@ describe('Test accounts blocklist', function () {
197 const block = blocks[0] 197 const block = blocks[0]
198 expect(block.byAccount.displayName).to.equal('root') 198 expect(block.byAccount.displayName).to.equal('root')
199 expect(block.byAccount.name).to.equal('root') 199 expect(block.byAccount.name).to.equal('root')
200 expect(block.accountBlocked.displayName).to.equal('user1') 200 expect(block.blockedAccount.displayName).to.equal('user1')
201 expect(block.accountBlocked.name).to.equal('user1') 201 expect(block.blockedAccount.name).to.equal('user1')
202 expect(block.accountBlocked.host).to.equal('localhost:9001') 202 expect(block.blockedAccount.host).to.equal('localhost:9001')
203 } 203 }
204 }) 204 })
205 205
@@ -267,7 +267,7 @@ describe('Test accounts blocklist', function () {
267 const block = blocks[0] 267 const block = blocks[0]
268 expect(block.byAccount.displayName).to.equal('root') 268 expect(block.byAccount.displayName).to.equal('root')
269 expect(block.byAccount.name).to.equal('root') 269 expect(block.byAccount.name).to.equal('root')
270 expect(block.serverBlocked.host).to.equal('localhost:9002') 270 expect(block.blockedServer.host).to.equal('localhost:9002')
271 }) 271 })
272 272
273 it('Should unblock the remote server', async function () { 273 it('Should unblock the remote server', async function () {