open-notebook/tests
Luis Novo a287d3b248
refactor: optimize duplicate model validation and improve error handling (#219)
* 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>
2025-10-25 08:48:18 -03:00
..
conftest.py refactor: optimize duplicate model validation and improve error handling (#219) 2025-10-25 08:48:18 -03:00
README.md Initial commit with all features 2024-10-21 14:56:10 -03:00
test_domain.py feat: simplify reverse proxy configuration with Next.js rewrites (#213) 2025-10-24 11:24:14 -03:00
test_graphs.py feat: simplify reverse proxy configuration with Next.js rewrites (#213) 2025-10-24 11:24:14 -03:00
test_models_api.py refactor: optimize duplicate model validation and improve error handling (#219) 2025-10-25 08:48:18 -03:00
test_utils.py feat: simplify reverse proxy configuration with Next.js rewrites (#213) 2025-10-24 11:24:14 -03:00

Coming Soon