From 00009ecc16200b5a9fae3ff161d64bb6e5c6fa22 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 26 Jun 2025 17:09:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(conf)=20add=20server=20to=20server?= =?UTF-8?q?=20api=20tokens=20to=20common?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have the e2e test "it creates a doc server way" that is quite complicated to run locally, because it requires the `DJANGO_SERVER_TO_SERVER_API_TOKENS` environment variable to be set in "env.d/development/common". We moved `DJANGO_SERVER_TO_SERVER_API_TOKENS` from "env.d/development/common.e2e.dist" to "env.d/development/common.dist", by doing so, this variable will be set by default in the "env.d/development/common" file, the test will now run without any additional configuration. --- env.d/development/common.dist | 1 + env.d/development/common.e2e.dist | 1 - src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/env.d/development/common.dist b/env.d/development/common.dist index f4a601c7..b1c44194 100644 --- a/env.d/development/common.dist +++ b/env.d/development/common.dist @@ -62,5 +62,6 @@ COLLABORATION_SERVER_ORIGIN=http://localhost:3000 COLLABORATION_SERVER_SECRET=my-secret COLLABORATION_WS_URL=ws://localhost:4444/collaboration/ws/ +DJANGO_SERVER_TO_SERVER_API_TOKENS=server-api-token Y_PROVIDER_API_BASE_URL=http://y-provider-development:4444/api/ Y_PROVIDER_API_KEY=yprovider-api-key diff --git a/env.d/development/common.e2e.dist b/env.d/development/common.e2e.dist index b5a51136..7f93927c 100644 --- a/env.d/development/common.e2e.dist +++ b/env.d/development/common.e2e.dist @@ -1,6 +1,5 @@ # For the CI job test-e2e BURST_THROTTLE_RATES="200/minute" COLLABORATION_API_URL=http://y-provider:4444/collaboration/api/ -DJANGO_SERVER_TO_SERVER_API_TOKENS=test-e2e SUSTAINED_THROTTLE_RATES="200/hour" Y_PROVIDER_API_BASE_URL=http://y-provider:4444/api/ \ No newline at end of file diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts index 8742dd87..e77615bc 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts @@ -39,6 +39,7 @@ test.describe('Doc Create: Not logged', () => { browserName, request, }) => { + const SERVER_TO_SERVER_API_TOKENS = 'server-api-token'; const markdown = `This is a normal text\n\n# And this is a large heading`; const [title] = randomName('My server way doc create', browserName, 1); const data = { @@ -53,7 +54,7 @@ test.describe('Doc Create: Not logged', () => { { data, headers: { - Authorization: 'Bearer test-e2e', + Authorization: `Bearer ${SERVER_TO_SERVER_API_TOKENS}`, format: 'json', }, },