From 3a2e45732064275a3a68f79f98ce9ee0dbd63112 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Aug 2024 14:51:30 +0200 Subject: [PATCH] Fix tests --- packages/tests/src/api/server/proxy.ts | 29 +++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/tests/src/api/server/proxy.ts b/packages/tests/src/api/server/proxy.ts index 6c9d5db69..071175943 100644 --- a/packages/tests/src/api/server/proxy.ts +++ b/packages/tests/src/api/server/proxy.ts @@ -84,6 +84,20 @@ describe('Test proxy', function () { describe('Videos import', async function () { + function getProxyConfig (url: string) { + return { + import: { + videos: { + http: { + proxies: url + ? [ url ] + : [] + } + } + } + } + } + function quickImport (expectedStatus: HttpStatusCodeType = HttpStatusCode.OK_200) { return servers[0].videoImports.importVideo({ attributes: { @@ -100,7 +114,7 @@ describe('Test proxy', function () { this.timeout(240000) await servers[0].kill() - await servers[0].run({}, { env: goodEnv }) + await servers[0].run(getProxyConfig(null), { env: goodEnv }) await quickImport() @@ -111,11 +125,20 @@ describe('Test proxy', function () { expect(data).to.have.lengthOf(3) }) - it('Should fail import with a wrong proxy config', async function () { + it('Should fail import with a wrong proxy config in env', async function () { this.timeout(120000) await servers[0].kill() - await servers[0].run({}, { env: badEnv }) + await servers[0].run(getProxyConfig(null), { env: badEnv }) + + await quickImport(HttpStatusCode.BAD_REQUEST_400) + }) + + it('Should fail import with a wrong proxy config in config', async function () { + this.timeout(120000) + + await servers[0].kill() + await servers[0].run(getProxyConfig('http://localhost:9000')) await quickImport(HttpStatusCode.BAD_REQUEST_400) })