notifications-fix
Some checks failed
Deploy on push / deploy (push) Failing after 5s

This commit is contained in:
2025-07-25 08:49:12 +03:00
parent 3ce870c81b
commit 0f16679a06
2 changed files with 25 additions and 71 deletions

View File

@@ -2,31 +2,24 @@ import pytest
from orm.notification import (
NotificationStatus,
NotificationKind,
NotificationEntity,
NotificationAction,
)
def test_notification_status():
"""Тестирование перечисления статусов уведомлений."""
assert NotificationStatus.UNREAD == NotificationStatus.from_string("UNREAD")
assert NotificationStatus.READ == NotificationStatus.from_string("READ")
assert NotificationStatus.UNREAD == NotificationStatus.UNREAD
assert NotificationStatus.READ == NotificationStatus.READ
with pytest.raises(ValueError):
NotificationStatus.from_string("INVALID_STATUS")
def test_notification_kind():
"""Тестирование перечисления типов уведомлений."""
assert NotificationKind.COMMENT == NotificationKind.from_string("COMMENT")
assert NotificationKind.MENTION == NotificationKind.from_string("MENTION")
with pytest.raises(ValueError):
NotificationKind.from_string("INVALID_KIND")
# Проверяем, что старый метод from_string больше не работает
with pytest.raises(AttributeError):
NotificationStatus.from_string("UNREAD")
def test_notification_entity():
"""Тестирование перечисления сущностей уведомлений."""
assert NotificationEntity.TOPIC == NotificationEntity.from_string("topic")
assert NotificationEntity.SHOUT == NotificationEntity.from_string("shout")
assert NotificationEntity.COMMENT == NotificationEntity.from_string("comment")
with pytest.raises(ValueError):
NotificationEntity.from_string("INVALID_ENTITY")
@@ -35,6 +28,7 @@ def test_notification_action():
"""Тестирование перечисления действий уведомлений."""
assert NotificationAction.CREATE == NotificationAction.from_string("create")
assert NotificationAction.UPDATE == NotificationAction.from_string("update")
assert NotificationAction.REACT == NotificationAction.from_string("react")
with pytest.raises(ValueError):
NotificationAction.from_string("INVALID_ACTION")