shokollm
961adf103b
test: add category feature tests
...
Tests for category feature (Issue #88 ):
Category Management Tests (11 tests):
- test_add_category_requires_admin
- test_add_category_duplicate_slug_fails
- test_add_category_invalid_slug_fails_uppercase
- test_add_category_invalid_slug_fails_with_numbers
- test_add_category_invalid_slug_fails_with_symbols
- test_add_category_invalid_slug_fails_empty
- test_add_category_valid
- test_delete_category_soft_deletes
- test_deleted_category_not_listed
- test_list_categories_empty
- test_list_categories_returns_active
- test_get_category_not_found
- test_get_category_deleted_returns_none
- test_add_category_requires_admin_non_existent_room
Category-to-Bounty Tests (10 tests):
- test_add_category_to_bounty
- test_add_duplicate_category_to_bounty_noop
- test_add_category_to_bounty_invalid_bounty
- test_add_category_to_bounty_invalid_category
- test_remove_category_from_bounty
- test_remove_category_not_on_bounty_returns_false
- test_update_bounty_categories_replace_all
- test_update_bounty_categories_clear_all
- test_update_bounty_categories_validates
- test_add_category_to_bounty_requires_admin
- test_remove_category_from_bounty_requires_admin
- test_update_bounty_categories_requires_admin
- test_delete_category_requires_admin
All 123 tests pass (96 original + 27 new)
2026-04-09 11:08:46 +00:00
shokollm
4885be0752
fix: cleanup codebase and sync SPEC with actual permissions
...
Phase 1: Ruff lint fixes
- Remove unused imports across all files
- Remove unused variables (now_utc, tz, ctx)
- Fix f-string without placeholders
- Fix E402 import order with noqa comments
Phase 2: Remove confusing hard delete from storage
- Removed delete_bounty() from RoomStorage Protocol (never used by app)
- Removed delete_bounty() from JsonFileRoomStorage (was hard delete)
- Removed corresponding tests (hard delete was never used)
Phase 3: Sync SPEC.md with actual code behavior
- Updated overview: admins can add/edit/delete (not 'anyone' + 'creator')
- Updated command table: /add, /edit, /delete are admin only
- Updated error handling messages
Test results: 96 passed (2 hard delete tests removed)
2026-04-09 10:01:02 +00:00
shokollm
8494b4621c
feat: switch admin identification from user_id to username
...
- Replace admin_user_ids (list[int]) with admin_usernames (list[str])
- Update all service methods to use username for permission checks
- Add delete button to bot responses for message cleanup
- Update tests to match new implementation
Note: Breaking change - existing data files need fresh start
2026-04-09 08:02:36 +00:00
shokollm
90b0b564c2
feat: add multi-ID delete support with per-ID results
...
- Add delete_bounties() method to BountyService that returns individual
results per bounty ID (deleted, not_found, permission_denied)
- Update cmd_delete to accept multiple IDs and show per-ID messages
- Add 3 tests for delete_bounties method
Example output:
/delete 1 2 3
✅ Bounty #1 deleted.
✅ Bounty #2 deleted.
⛔ Bounty #3 not found.
Fixes #47
2026-04-04 13:06:56 +00:00
shokollm
c005ee341a
Revert "Merge pull request 'feat: add multi-ID delete support with per-ID results' ( #63 ) from fix/issue-47 into main"
...
This reverts commit bd2627efe9 , reversing
changes made to 42ed551554 .
2026-04-04 07:24:03 +00:00
shokollm
8069ed6465
feat: add multi-ID delete support with per-ID results
...
- Add delete_bounties method to BountyService that returns individual
results per bounty ID (deleted, not_found, permission_denied)
- Update cmd_delete to accept multiple IDs and show per-ID messages
- Add tests for delete_bounties
Example output:
/delete 1 2 3
✅ Bounty #1 deleted.
✅ Bounty #2 deleted.
⛔ Bounty #3 not found.
Fixes #47
2026-04-04 06:39:11 +00:00
shokollm
af7774ef03
feat: implement service layer for Phase 2 - admin management, timezone, soft delete
...
BountyService:
- Add is_admin(), add_admin(), remove_admin(), list_admins()
- Add set_timezone(), get_timezone()
- Add check_link_unique(), list_deleted_bounties()
- Modify add_bounty() to check link uniqueness and require admin
- Modify update_bounty() to require admin permission (not creator)
- Modify delete_bounty() to perform soft delete (set deleted_at)
- get_bounty() now filters out soft-deleted bounties
- list_bounties() uses storage.list_bounties() which excludes soft-deleted
TrackingService:
- get_tracked_bounties() now filters out soft-deleted bounties
Tests updated to reflect new admin-only permissions and soft delete behavior.
2026-04-04 05:27:40 +00:00
shokollm
3feab1d469
test(services): add unit tests for BountyService and TrackingService
...
- Test BountyService: add_bounty, list_bounties, get_bounty, update_bounty, delete_bounty
- Test TrackingService: track_bounty, untrack_bounty, get_tracked_bounties
- Test edge cases: permission errors, not found, duplicate tracking
2026-04-03 11:36:07 +00:00