mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 02:31:45 +01:00
test: strengthen coverage for sessions, logging, and update check (#686)
## ℹ️ Description * Strengthen the session/logging/update-check tests to exercise real resources and guards while bringing the update-check docs in line with the supported interval units. - Link to the related issue(s): Issue #N/A ## 📋 Changes Summary - Reworked the `WebScrapingMixin` session tests so they capture each `stop` handler before the browser reference is nulled, ensuring cleanup logic is exercised without crashing. - Added targeted publish and update-check tests that patch the async helpers, guard logic, and logging handlers while confirming `requests.get` is skipped when the state gate is closed. - Updated `docs/update-check.md` to list only the actually supported interval units (up to 30 days) and noted the new guard coverage in the changelog. ### ⚙️ Type of Change - [x] 🐞 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (adds new functionality without breaking existing usage) - [ ] 💥 Breaking change (changes that might break existing user setups, scripts, or configurations) ## ✅ Checklist - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Expanded test coverage for publish workflow orchestration and update checking interval behavior. * Added comprehensive browser session cleanup tests, including idempotent operations and edge case handling. * Consolidated logging configuration tests with improved handler management validation. * Refined test fixtures and assertions for better test reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -22,16 +22,15 @@ The interval is specified as a number followed by a unit:
|
||||
- `m`: minutes
|
||||
- `h`: hours
|
||||
- `d`: days
|
||||
- `w`: weeks
|
||||
|
||||
Examples:
|
||||
- `7d`: Check every 7 days
|
||||
- `12h`: Check every 12 hours
|
||||
- `1w`: Check every week
|
||||
- `30d`: Check every 30 days
|
||||
|
||||
Validation rules:
|
||||
- Minimum interval: 1 day (`1d`)
|
||||
- Maximum interval: 4 weeks (`4w`)
|
||||
- Maximum interval: 30 days (`30d`, roughly 4 weeks)
|
||||
- Value must be positive
|
||||
- Only supported units are allowed
|
||||
|
||||
@@ -93,4 +92,4 @@ The feature logs various events:
|
||||
- State file operations (load, save, migration)
|
||||
- Error conditions (network, API, parsing, etc.)
|
||||
- Interval validation warnings
|
||||
- Timezone conversion information
|
||||
- Timezone conversion information
|
||||
|
||||
Reference in New Issue
Block a user