diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-09 11:00:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-09 11:00:30 +0200 |
commit | 1b05d82d861f42c27766e9f24d8d55e68b0cf098 (patch) | |
tree | bbf14abc606dd3f8f0c13625afbdf3b17fea3a23 /server/tests/plugins | |
parent | bc0d801bb7a0cc503c1637f4a07bb51d68d85608 (diff) | |
download | PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.gz PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.zst PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.zip |
Add SQL query support in plugins
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/index.ts | 1 | ||||
-rw-r--r-- | server/tests/plugins/plugin-helpers.ts | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/server/tests/plugins/index.ts b/server/tests/plugins/index.ts index f41708055..9c9499a79 100644 --- a/server/tests/plugins/index.ts +++ b/server/tests/plugins/index.ts | |||
@@ -2,3 +2,4 @@ import './action-hooks' | |||
2 | import './filter-hooks' | 2 | import './filter-hooks' |
3 | import './translations' | 3 | import './translations' |
4 | import './video-constants' | 4 | import './video-constants' |
5 | import './plugin-helpers' | ||
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts new file mode 100644 index 000000000..05928273f --- /dev/null +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -0,0 +1,38 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | ||
5 | import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' | ||
6 | import { getPluginTestPath, installPlugin, setAccessTokensToServers } from '../../../shared/extra-utils' | ||
7 | |||
8 | const expect = chai.expect | ||
9 | |||
10 | describe('Test plugin helpers', function () { | ||
11 | let server: ServerInfo | ||
12 | |||
13 | before(async function () { | ||
14 | this.timeout(30000) | ||
15 | |||
16 | server = await flushAndRunServer(1) | ||
17 | await setAccessTokensToServers([ server ]) | ||
18 | |||
19 | await installPlugin({ | ||
20 | url: server.url, | ||
21 | accessToken: server.accessToken, | ||
22 | path: getPluginTestPath('-four') | ||
23 | }) | ||
24 | }) | ||
25 | |||
26 | it('Should have logged things', async function () { | ||
27 | await waitUntilLog(server, 'localhost:' + server.port + ' peertube-plugin-test-four', 1, false) | ||
28 | await waitUntilLog(server, 'Hello world from plugin four', 1) | ||
29 | }) | ||
30 | |||
31 | it('Should have made a query', async function () { | ||
32 | await waitUntilLog(server, `root email is admin${server.internalServerNumber}@example.com`, 1) | ||
33 | }) | ||
34 | |||
35 | after(async function () { | ||
36 | await cleanupTests([ server ]) | ||
37 | }) | ||
38 | }) | ||