From af5767ffae41b2d5604e41ba9a7225c623dd6735 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Oct 2018 17:26:40 +0200 Subject: Add user/instance block by users in the client --- server/tests/api/check-params/blocklist.ts | 20 ++++++++++++++++++++ server/tests/api/users/account-blocklist.ts | 14 +++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'server/tests/api') 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 () { }) }) + it('Should fail to block ourselves', async function () { + await makePostBodyRequest({ + url: server.url, + token: server.accessToken, + path, + fields: { accountName: 'root' }, + statusCodeExpected: 409 + }) + }) + it('Should succeed with the correct params', async function () { await makePostBodyRequest({ url: server.url, @@ -170,6 +180,16 @@ describe('Test blocklist API validators', function () { }) }) + it('Should fail with our own server', async function () { + await makePostBodyRequest({ + url: server.url, + token: server.accessToken, + path, + fields: { host: 'localhost:9001' }, + statusCodeExpected: 409 + }) + }) + it('Should succeed with the correct params', async function () { await makePostBodyRequest({ 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 () { const block = blocks[0] expect(block.byAccount.displayName).to.equal('root') expect(block.byAccount.name).to.equal('root') - expect(block.accountBlocked.displayName).to.equal('user2') - expect(block.accountBlocked.name).to.equal('user2') - expect(block.accountBlocked.host).to.equal('localhost:9002') + expect(block.blockedAccount.displayName).to.equal('user2') + expect(block.blockedAccount.name).to.equal('user2') + expect(block.blockedAccount.host).to.equal('localhost:9002') } { @@ -197,9 +197,9 @@ describe('Test accounts blocklist', function () { const block = blocks[0] expect(block.byAccount.displayName).to.equal('root') expect(block.byAccount.name).to.equal('root') - expect(block.accountBlocked.displayName).to.equal('user1') - expect(block.accountBlocked.name).to.equal('user1') - expect(block.accountBlocked.host).to.equal('localhost:9001') + expect(block.blockedAccount.displayName).to.equal('user1') + expect(block.blockedAccount.name).to.equal('user1') + expect(block.blockedAccount.host).to.equal('localhost:9001') } }) @@ -267,7 +267,7 @@ describe('Test accounts blocklist', function () { const block = blocks[0] expect(block.byAccount.displayName).to.equal('root') expect(block.byAccount.name).to.equal('root') - expect(block.serverBlocked.host).to.equal('localhost:9002') + expect(block.blockedServer.host).to.equal('localhost:9002') }) it('Should unblock the remote server', async function () { -- cgit v1.2.3