coverage tests spawn local server with authentication for read-write requests
Sonarqube Scanner / Build and analyze (push) Successful in 1m57s

This commit is contained in:
Florian Zumpe
2026-06-17 13:38:05 +02:00
parent d0046f5693
commit 8df484e77e
8 changed files with 247 additions and 36 deletions
+5 -5
View File
@@ -55,9 +55,9 @@ test('Python API tools are syntax-valid and contain reusable 401 authentication
});
test('Python client retries the same request with API_USER and API_PASSWORD after HTTP 401', async t => {
const apiUser = process.env.API_USER || 'tester';
const apiPassword = process.env.API_PASSWORD || 'secret';
test('Python client retries an intentionally simulated reverse-proxy 401 with trimmed environment credentials', async t => {
const apiUser = 'local-test-user';
const apiPassword = 'local-test-password';
const expectedAuthorization = `Basic ${Buffer.from(`${apiUser}:${apiPassword}`).toString('base64')}`;
const receivedAuthorization = [];
@@ -83,8 +83,8 @@ assert result == {'ok': True}
const child = spawn('python3', ['-c', script], {
env: {
...process.env,
API_USER: apiUser,
API_PASSWORD: apiPassword,
API_USER: ` ${apiUser} `,
API_PASSWORD: ` ${apiPassword} `,
PYTHONPATH: path.join(root, 'tools/python')
},
stdio: ['ignore', 'pipe', 'pipe']