From b379759f55a35837b803a3b988674972db2903d1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Jan 2023 09:28:29 +0100 Subject: Add signup approval API tests --- server/tests/fixtures/peertube-plugin-test/main.js | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'server/tests/fixtures') diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index 19ba9f278..5b4d34f15 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js @@ -226,16 +226,29 @@ async function register ({ registerHook, registerSetting, settingsManager, stora } }) - registerHook({ - target: 'filter:api.user.signup.allowed.result', - handler: (result, params) => { - if (params && params.body && params.body.email && params.body.email.includes('jma')) { - return { allowed: false, errorMessage: 'No jma' } + { + registerHook({ + target: 'filter:api.user.signup.allowed.result', + handler: (result, params) => { + if (params && params.body && params.body.email && params.body.email.includes('jma 1')) { + return { allowed: false, errorMessage: 'No jma 1' } + } + + return result } + }) - return result - } - }) + registerHook({ + target: 'filter:api.user.request-signup.allowed.result', + handler: (result, params) => { + if (params && params.body && params.body.email && params.body.email.includes('jma 2')) { + return { allowed: false, errorMessage: 'No jma 2' } + } + + return result + } + }) + } registerHook({ target: 'filter:api.download.torrent.allowed.result', -- cgit v1.2.3