Update project documentation to reflect Phase 2 completion and enhanced features, including configuration management, advanced sorting, and improved visual design.

This commit is contained in:
Philip Henning 2025-07-29 21:27:35 +02:00
parent 0051932014
commit fa7e7718c9
5 changed files with 380 additions and 216 deletions

View file

@ -47,24 +47,29 @@ hosts/
├── README.md
├── src/
│ └── hosts/
│ ├── init.py
│ ├── __init__.py
│ ├── main.py # Entry point (uv run hosts)
│ ├── tui/ # UI components (Textual)
│ │ ├── init.py
│ │ └── views.py
│ │ ├── __init__.py
│ │ └── config_modal.py # Configuration modal dialog
│ ├── core/ # Business logic
│ │ ├── init.py
│ │ ├── __init__.py
│ │ ├── parser.py # /etc/hosts parsing & writing
│ │ ├── models.py # Data models (Entry, Comment, etc.)
│ │ ├── dns.py # DNS resolution & comparison
│ │ └── manager.py # Core operations (activate, sort, reorder)
│ └── utils.py
│ │ ├── config.py # Configuration management
│ │ ├── dns.py # DNS resolution & comparison (planned)
│ │ └── manager.py # Core operations (planned for edit mode)
│ └── utils.py # Shared utilities (planned)
└── tests/
├── init.py
├── test_parser.py
├── test_manager.py
├── test_dns.py
└── test_tui.py
├── __init__.py
├── test_parser.py # Parser tests
├── test_models.py # Data model tests
├── test_config.py # Configuration tests
├── test_config_modal.py # Modal dialog tests
├── test_main.py # Main application tests
├── test_manager.py # Core operations tests (planned)
├── test_dns.py # DNS resolution tests (planned)
└── test_tui.py # Additional TUI tests (planned)
## Testing Strategy (TDD)
@ -76,12 +81,40 @@ hosts/
- Mock `/etc/hosts` file I/O and DNS lookups to avoid system dependencies.
- Include integration tests for the Textual TUI (using `textual.testing` or snapshot testing).
### Example Tests to Start With (MVP)
### Implemented Tests (97 tests total)
1. **Parsing Tests**:
- Parse simple `/etc/hosts` with comments and disabled entries.
- Ensure writing back preserves file integrity.
2. **Activation/Deactivation Tests**:
- Toggle entries and validate updated state.
3. **TUI Rendering Tests**:
- Ensure initial layout shows entries correctly.
1. **Parsing Tests** (15 tests):
- Parse simple `/etc/hosts` with comments and disabled entries
- Ensure writing back preserves file integrity
- Handle edge cases like empty files, comments-only files
- Validate round-trip parsing accuracy
2. **Data Model Tests** (27 tests):
- HostEntry creation, validation, and serialization
- HostsFile container operations and state management
- IP address validation for IPv4 and IPv6
- Hostname validation and edge cases
3. **Configuration Tests** (22 tests):
- JSON persistence and error handling
- Default settings management
- Configuration loading and saving
- Default entry detection and filtering
4. **Modal Dialog Tests** (15 tests):
- Configuration modal lifecycle
- User interaction handling
- Keyboard binding validation
- State management during configuration changes
5. **Main Application Tests** (18 tests):
- Application initialization and startup
- File loading and error handling
- User interface state management
- Sorting and navigation functionality
### Future Test Areas (Planned)
- **Edit Mode Tests**: Permission management and file modification
- **DNS Resolution Tests**: Hostname resolution and IP comparison
- **Performance Tests**: Large file handling and optimization
- **Integration Tests**: End-to-end workflow testing