diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-07 17:08:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-05-07 17:08:16 +0200 |
commit | 91b8e675e26dd65e1ebb23706cb16b3a3f8bcf73 (patch) | |
tree | 81666673c3fcdc64dd2598ce4713752bafac1d64 /server/tests/external-plugins | |
parent | 716adfaed6d8e549521b6dfe8bf5960d9f73bbd6 (diff) | |
download | PeerTube-91b8e675e26dd65e1ebb23706cb16b3a3f8bcf73.tar.gz PeerTube-91b8e675e26dd65e1ebb23706cb16b3a3f8bcf73.tar.zst PeerTube-91b8e675e26dd65e1ebb23706cb16b3a3f8bcf73.zip |
Improve auto mute tests
Diffstat (limited to 'server/tests/external-plugins')
-rw-r--r-- | server/tests/external-plugins/auto-mute.ts | 60 |
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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | |||
5 | |||
6 | import { installPlugin, MockBlocklist, setAccessTokensToServers, uploadVideoAndGetId, updatePluginSettings, doubleFollow, getVideosList, wait } from '../../../shared/extra-utils' | ||
7 | import { cleanupTests, flushAndRunMultipleServers, ServerInfo } from '../../../shared/extra-utils/server/servers' | ||
8 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { removeAccountFromServerBlocklist } from '@shared/extra-utils/users/blocklist' | ||
6 | import { | ||
7 | doubleFollow, | ||
8 | getVideosList, | ||
9 | installPlugin, | ||
10 | MockBlocklist, | ||
11 | setAccessTokensToServers, | ||
12 | updatePluginSettings, | ||
13 | uploadVideoAndGetId, | ||
14 | wait | ||
15 | } from '../../../shared/extra-utils' | ||
16 | import { | ||
17 | cleanupTests, | ||
18 | flushAndRunMultipleServers, | ||
19 | killallServers, | ||
20 | reRunServer, | ||
21 | ServerInfo | ||
22 | } from '../../../shared/extra-utils/server/servers' | ||
9 | 23 | ||
10 | describe('Official plugin auto-mute', function () { | 24 | describe('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 | }) |