import 'mocha'
import {
+ cleanupTests,
createUser,
doubleFollow,
flushAndRunMultipleServers,
- flushTests,
- killallServers,
makeDeleteRequest,
makeGetRequest,
makePostBodyRequest,
ServerInfo,
- setAccessTokensToServers, userLogin
+ setAccessTokensToServers,
+ userLogin
} from '../../../../shared/extra-utils'
import {
checkBadCountPagination,
url: server.url,
token: server.accessToken,
path,
- fields: { host: 'localhost:9001' },
+ fields: { host: 'localhost:' + server.port },
statusCodeExpected: 409
})
})
url: server.url,
token: server.accessToken,
path,
- fields: { host: 'localhost:9002' },
+ fields: { host: 'localhost:' + servers[1].port },
statusCodeExpected: 204
})
})
it('Should fail with an unauthenticated user', async function () {
await makeDeleteRequest({
url: server.url,
- path: path + '/localhost:9002',
+ path: path + '/localhost:' + servers[1].port,
statusCodeExpected: 401
})
})
it('Should succeed with the correct params', async function () {
await makeDeleteRequest({
url: server.url,
- path: path + '/localhost:9002',
+ path: path + '/localhost:' + servers[1].port,
token: server.accessToken,
statusCodeExpected: 204
})
await makePostBodyRequest({
url: server.url,
path,
- fields: { host: 'localhost:9002' },
+ fields: { host: 'localhost:' + servers[1].port },
statusCodeExpected: 401
})
})
url: server.url,
token: userAccessToken,
path,
- fields: { host: 'localhost:9002' },
+ fields: { host: 'localhost:' + servers[1].port },
statusCodeExpected: 403
})
})
url: server.url,
token: server.accessToken,
path,
- fields: { host: 'localhost:9001' },
+ fields: { host: 'localhost:' + server.port },
statusCodeExpected: 409
})
})
url: server.url,
token: server.accessToken,
path,
- fields: { host: 'localhost:9002' },
+ fields: { host: 'localhost:' + servers[1].port },
statusCodeExpected: 204
})
})
it('Should fail with an unauthenticated user', async function () {
await makeDeleteRequest({
url: server.url,
- path: path + '/localhost:9002',
+ path: path + '/localhost:' + servers[1].port,
statusCodeExpected: 401
})
})
it('Should fail with a user without the appropriate rights', async function () {
await makeDeleteRequest({
url: server.url,
- path: path + '/localhost:9002',
+ path: path + '/localhost:' + servers[1].port,
token: userAccessToken,
statusCodeExpected: 403
})
it('Should succeed with the correct params', async function () {
await makeDeleteRequest({
url: server.url,
- path: path + '/localhost:9002',
+ path: path + '/localhost:' + servers[1].port,
token: server.accessToken,
statusCodeExpected: 204
})
})
})
- after(function () {
- killallServers(servers)
+ after(async function () {
+ await cleanupTests(servers)
})
})