aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/external-plugins/auto-mute.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/external-plugins/auto-mute.ts')
-rw-r--r--server/tests/external-plugins/auto-mute.ts60
1 files changed, 56 insertions, 4 deletions
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index 49b104882..2f2c9102d 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -1,11 +1,25 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4
5
6import { installPlugin, MockBlocklist, setAccessTokensToServers, uploadVideoAndGetId, updatePluginSettings, doubleFollow, getVideosList, wait } from '../../../shared/extra-utils'
7import { cleanupTests, flushAndRunMultipleServers, ServerInfo } from '../../../shared/extra-utils/server/servers'
8import { expect } from 'chai' 4import { expect } from 'chai'
5import { removeAccountFromServerBlocklist } from '@shared/extra-utils/users/blocklist'
6import {
7 doubleFollow,
8 getVideosList,
9 installPlugin,
10 MockBlocklist,
11 setAccessTokensToServers,
12 updatePluginSettings,
13 uploadVideoAndGetId,
14 wait
15} from '../../../shared/extra-utils'
16import {
17 cleanupTests,
18 flushAndRunMultipleServers,
19 killallServers,
20 reRunServer,
21 ServerInfo
22} from '../../../shared/extra-utils/server/servers'
9 23
10describe('Official plugin auto-mute', function () { 24describe('Official plugin auto-mute', function () {
11 let servers: ServerInfo[] 25 let servers: ServerInfo[]
@@ -114,6 +128,44 @@ describe('Official plugin auto-mute', function () {
114 expect(res.body.total).to.equal(2) 128 expect(res.body.total).to.equal(2)
115 }) 129 })
116 130
131 it('Should auto mute an account, manually unmute it and do not remute it automatically', async function () {
132 this.timeout(20000)
133
134 const account = 'root@localhost:' + servers[1].port
135
136 blocklistServer.replace({
137 data: [
138 {
139 value: account,
140 updatedAt: new Date().toISOString()
141 }
142 ]
143 })
144
145 await wait(2000)
146
147 {
148 const res = await getVideosList(servers[0].url)
149 expect(res.body.total).to.equal(1)
150 }
151
152 await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, account)
153
154 {
155 const res = await getVideosList(servers[0].url)
156 expect(res.body.total).to.equal(2)
157 }
158
159 killallServers([ servers[0] ])
160 await reRunServer(servers[0])
161 await wait(2000)
162
163 {
164 const res = await getVideosList(servers[0].url)
165 expect(res.body.total).to.equal(2)
166 }
167 })
168
117 after(async function () { 169 after(async function () {
118 await cleanupTests(servers) 170 await cleanupTests(servers)
119 }) 171 })