import 'mocha'
import * as chai from 'chai'
-import { getUserNotifications, markAsReadAllNotifications } from '@shared/extra-utils/users/user-notifications'
-import { addUserSubscription, removeUserSubscription } from '@shared/extra-utils/users/user-subscriptions'
-import { UserNotification, UserNotificationType } from '@shared/models'
import {
+ addVideoCommentThread,
cleanupTests,
createUser,
doubleFollow,
flushAndRunMultipleServers,
+ getUserNotifications,
+ markAsReadAllNotifications,
ServerInfo,
+ setAccessTokensToServers,
uploadVideo,
- userLogin
-} from '../../../../shared/extra-utils/index'
-import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
-import {
- addAccountToAccountBlocklist,
- addAccountToServerBlocklist,
- addServerToAccountBlocklist,
- addServerToServerBlocklist,
- removeAccountFromAccountBlocklist,
- removeAccountFromServerBlocklist,
- removeServerFromAccountBlocklist
-} from '../../../../shared/extra-utils/users/blocklist'
-import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
-import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
+ userLogin,
+ waitJobs
+} from '@shared/extra-utils'
+import { UserNotification, UserNotificationType } from '@shared/models'
const expect = chai.expect
async function resetState () {
try {
- await removeUserSubscription(servers[1].url, remoteUserToken, 'user1_channel@' + servers[0].host)
- await removeUserSubscription(servers[1].url, remoteUserToken, 'user2_channel@' + servers[0].host)
+ await servers[1].subscriptionsCommand.remove({ token: remoteUserToken, uri: 'user1_channel@' + servers[0].host })
+ await servers[1].subscriptionsCommand.remove({ token: remoteUserToken, uri: 'user2_channel@' + servers[0].host })
} catch {}
await waitJobs(servers)
{
- await addUserSubscription(servers[1].url, remoteUserToken, 'user1_channel@' + servers[0].host)
- await addUserSubscription(servers[1].url, remoteUserToken, 'user2_channel@' + servers[0].host)
+ await servers[1].subscriptionsCommand.add({ token: remoteUserToken, targetUri: 'user1_channel@' + servers[0].host })
+ await servers[1].subscriptionsCommand.add({ token: remoteUserToken, targetUri: 'user2_channel@' + servers[0].host })
}
await waitJobs(servers)
it('Should block an account', async function () {
this.timeout(10000)
- await addAccountToAccountBlocklist(servers[0].url, userToken1, 'user3@' + servers[1].host)
+ await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host })
await waitJobs(servers)
})
await checkNotifications(servers[0].url, userToken2, notifs)
- await removeAccountFromAccountBlocklist(servers[0].url, userToken1, 'user3@' + servers[1].host)
+ await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host })
})
})
it('Should block an account', async function () {
this.timeout(10000)
- await addServerToAccountBlocklist(servers[0].url, userToken1, servers[1].host)
+ await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken1, server: servers[1].host })
await waitJobs(servers)
})
await checkNotifications(servers[0].url, userToken2, notifs)
- await removeServerFromAccountBlocklist(servers[0].url, userToken1, servers[1].host)
+ await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken1, server: servers[1].host })
})
})
it('Should block an account', async function () {
this.timeout(10000)
- await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'user3@' + servers[1].host)
+ await servers[0].blocklistCommand.addToServerBlocklist({ account: 'user3@' + servers[1].host })
await waitJobs(servers)
})
await checkNotifications(servers[0].url, userToken1, [])
await checkNotifications(servers[0].url, userToken2, [])
- await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'user3@' + servers[1].host)
+ await servers[0].blocklistCommand.removeFromServerBlocklist({ account: 'user3@' + servers[1].host })
})
})
it('Should block an account', async function () {
this.timeout(10000)
- await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, servers[1].host)
+ await servers[0].blocklistCommand.addToServerBlocklist({ server: servers[1].host })
await waitJobs(servers)
})