Add TelegramClient tests #32

Closed
opened 2026-02-04 21:26:27 +09:00 by agentson · 0 comments
Collaborator

Goal

Add comprehensive tests for TelegramClient module.

Scope

  • Create tests/test_telegram.py
  • Test classes:
    • TestTelegramClientInit (4 tests): disabled scenarios, enabled with credentials
    • TestNotificationSending (6 tests): disabled mode, message format, API errors, timeouts, session management
    • TestRateLimiting (1 test): rate limiter enforcement
    • TestMessagePriorities (2 tests): priority emoji verification
    • TestClientCleanup (2 tests): session cleanup

Implementation Notes

  • Use pytest.mark.asyncio for async tests
  • Mock aiohttp responses with AsyncMock
  • Follow test patterns from tests/test_broker.py

Success Criteria

  • 13+ tests pass
  • 80%+ coverage for src/notifications/
  • All error scenarios tested (timeout, API errors, graceful degradation)

Dependencies

  • Requires issue #31 (TelegramClient core) to be completed

Part 2 of Telegram notification system implementation

## Goal Add comprehensive tests for TelegramClient module. ## Scope - Create `tests/test_telegram.py` - Test classes: - TestTelegramClientInit (4 tests): disabled scenarios, enabled with credentials - TestNotificationSending (6 tests): disabled mode, message format, API errors, timeouts, session management - TestRateLimiting (1 test): rate limiter enforcement - TestMessagePriorities (2 tests): priority emoji verification - TestClientCleanup (2 tests): session cleanup ## Implementation Notes - Use pytest.mark.asyncio for async tests - Mock aiohttp responses with AsyncMock - Follow test patterns from tests/test_broker.py ## Success Criteria - 13+ tests pass - 80%+ coverage for src/notifications/ - All error scenarios tested (timeout, API errors, graceful degradation) ## Dependencies - Requires issue #31 (TelegramClient core) to be completed ## Related Part 2 of Telegram notification system implementation
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#32