feat: тесты

This commit is contained in:
Artem Tsyrulnikov
2025-11-10 16:21:14 +03:00
parent cd167fdb43
commit b43042c745
13 changed files with 949 additions and 6 deletions

View File

@@ -10,8 +10,14 @@ log = logging.getLogger(__name__)
async def disconnect_target_chan_by_tg_id(self: 'Usecase', input: dto.DisconnectTargetChanByTgIdInput) -> None:
# Получаем user_id по telegram_id
user = await self.database.get_user(telegram_id=input.user_telegram_id)
if not user:
log.warning(f'User with telegram_id {input.user_telegram_id} not found when disconnecting channel')
return
async with self.database.transaction():
channel = await self.database.get_target_channel(input.user_id, telegram_id=input.telegram_id)
channel = await self.database.get_target_channel(user.id, telegram_id=input.telegram_id)
if not channel:
log.warning(f'Target channel {input.telegram_id} not found')
raise domain.TargetChannelNotFound()

View File

@@ -16,8 +16,14 @@ async def update_target_chan_permissions(self: 'Usecase', input: dto.UpdateTarge
if not input.permissions.can_restrict_members:
missing_permissions.append('Управление пользователями')
# Получаем user_id по telegram_id
user = await self.database.get_user(telegram_id=input.user_telegram_id)
if not user:
log.warning(f'User with telegram_id {input.user_telegram_id} not found when updating channel permissions')
return
async with self.database.transaction():
channel = await self.database.get_target_channel(user_id, telegram_id=input.telegram_id)
channel = await self.database.get_target_channel(user.id, telegram_id=input.telegram_id)
if not channel:
log.warning(f'Target channel {input.telegram_id} not found when permissions changed')
raise domain.TargetChannelNotFound()