GestionTablets/tests/__init__.py
ijuanes 83ac67fea2 test: add comprehensive unit test suite
- Add tests/ directory with pytest configuration
- Add conftest.py with database fixtures (test_db, sample data)
- Add test_core.py: 21 tests for core operations (tablet, user, loan CRUD)
- Add test_edge_cases.py: 14 tests for edge cases (duplicates, invalid IDs, etc.)
- Add test_minimal_app.py: 11 tests for actual application functions
- Update pyproject.toml with pytest and coverage configuration
- Total: 46 tests covering core functionality and edge cases

Tests cover:
- Tablet CRUD operations
- User CRUD operations
- Loan/return workflows
- Duplicate prevention (serial numbers, identifications)
- Invalid ID handling
- Already loaned device prevention
- Non-existent loan handling
- Multiple loans per user (one-to-many relationship)
- Non-loanable device CRUD operations

To run: python3 -m pytest tests/ -v
2026-06-17 17:07:20 +01:00

3 lines
48 B
Python

"""
Unit tests for Tablet Management System
"""