Skip to content

Commit f8de8bd

Browse files
patchmemoryclaude
andcommitted
fix(tests): add bcrypt to pyproject.toml and fix E2E auth bypass
Fixed two test failures: 1. GitHub CI: Added bcrypt>=4.0 to pyproject.toml dependencies (was only in requirements.txt, but CI uses pyproject.toml) 2. E2E Tests: Extended auth middleware to detect E2E test environment - Added SCIDK_E2E_TEST env var in global-setup.ts - Updated auth_middleware.py to skip auth when SCIDK_E2E_TEST is set - E2E tests run Flask in subprocess, so pytest detection doesn't work This allows E2E tests to run without authentication unless PYTEST_TEST_AUTH is explicitly set (for auth-specific E2E tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3caeff6 commit f8de8bd

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

e2e/global-setup.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ let proc: ChildProcessWithoutNullStreams | null = null;
2525

2626
export default async function globalSetup(config: FullConfig) {
2727
const port = 5010 + Math.floor(Math.random() * 500);
28-
const env = { ...process.env, PORT: String(port), FLASK_ENV: 'development' };
28+
const env = {
29+
...process.env,
30+
PORT: String(port),
31+
FLASK_ENV: 'development',
32+
SCIDK_E2E_TEST: '1' // Disable auth for E2E tests
33+
};
2934

3035
// Prefer running the Flask app directly via Python to avoid Flask CLI dependency
3136
const pyCode = [

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"jsonpath-ng>=1.6",
2222
"pandas>=2.0",
2323
"rapidfuzz>=3.0",
24+
"bcrypt>=4.0",
2425
]
2526

2627
[project.optional-dependencies]

scidk/web/auth_middleware.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ def check_auth():
5050
None if authentication passes, redirect Response if not authenticated
5151
"""
5252
# Skip auth check in testing mode (unless specifically testing auth)
53-
# Check both TESTING config and if we're running under pytest
53+
# Check both TESTING config and if we're running under pytest or E2E tests
5454
import os
5555
import sys
56-
is_testing = current_app.config.get('TESTING', False) or 'pytest' in sys.modules
56+
is_testing = (
57+
current_app.config.get('TESTING', False) or
58+
'pytest' in sys.modules or
59+
os.environ.get('SCIDK_E2E_TEST')
60+
)
5761
if is_testing:
5862
# Only enforce auth in tests that explicitly enable it
5963
if not os.environ.get('PYTEST_TEST_AUTH'):

0 commit comments

Comments
 (0)