mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-05-05 15:24:35 +00:00
Some checks are pending
Development Build / extract-version (push) Waiting to run
Development Build / test-build-regular (push) Blocked by required conditions
Development Build / test-build-single (push) Blocked by required conditions
Development Build / summary (push) Blocked by required conditions
* feat: prevent duplicate model names under same provider Implement case-insensitive validation to prevent users from creating duplicate model names under the same provider. This validation is implemented both in the backend API and the frontend UI. Changes: - Backend: Add duplicate check in create_model endpoint (case-insensitive) - Frontend: Add client-side validation in AddModelForm - Frontend: Improve error message display from backend - Tests: Add unit tests for duplicate model validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: optimize duplicate model validation and improve error handling - Replace O(n) model iteration with efficient SurrealDB query for duplicate check - Improve error message to include model name and provider for better UX - Remove frontend duplicate validation (backend-only enforcement) - Fix test authentication by setting OPEN_NOTEBOOK_PASSWORD before imports - Update test mocking to use repo_query instead of Model.get_all() - Add pytest fixture for TestClient to ensure proper test isolation All 11 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * remove unnecessary package * fix: replace any with unknown type in error handler - Change error type from 'any' to 'unknown' to satisfy ESLint - Add proper type assertion for error object structure - Maintains same runtime behavior with better type safety --------- Co-authored-by: Claude <noreply@anthropic.com>
19 lines
588 B
Python
19 lines
588 B
Python
"""
|
|
Pytest configuration file.
|
|
|
|
This file ensures that the project root is in the Python path,
|
|
allowing tests to import from the api and open_notebook modules.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Ensure password auth is disabled for tests BEFORE any imports
|
|
# The PasswordAuthMiddleware skips auth when this env var is not set
|
|
# Set to empty string instead of deleting to prevent it from being reloaded
|
|
os.environ["OPEN_NOTEBOOK_PASSWORD"] = ""
|
|
|
|
# Add the project root to the Python path
|
|
project_root = Path(__file__).parent.parent
|
|
sys.path.insert(0, str(project_root))
|