Files
core/tests/test_notification.py

35 lines
1.5 KiB
Python
Raw Normal View History

2025-07-25 01:17:23 +03:00
import pytest
from orm.notification import (
NotificationStatus,
NotificationEntity,
NotificationAction,
)
def test_notification_status():
"""Тестирование перечисления статусов уведомлений."""
2025-07-25 08:49:12 +03:00
assert NotificationStatus.UNREAD == NotificationStatus.UNREAD
assert NotificationStatus.READ == NotificationStatus.READ
2025-07-25 01:17:23 +03:00
2025-07-25 08:49:12 +03:00
# Проверяем, что старый метод from_string больше не работает
with pytest.raises(AttributeError):
NotificationStatus.from_string("UNREAD")
2025-07-25 01:17:23 +03:00
def test_notification_entity():
"""Тестирование перечисления сущностей уведомлений."""
assert NotificationEntity.TOPIC == NotificationEntity.from_string("topic")
assert NotificationEntity.SHOUT == NotificationEntity.from_string("shout")
2025-07-25 08:49:12 +03:00
assert NotificationEntity.COMMENT == NotificationEntity.from_string("comment")
2025-07-25 01:17:23 +03:00
with pytest.raises(ValueError):
NotificationEntity.from_string("INVALID_ENTITY")
def test_notification_action():
"""Тестирование перечисления действий уведомлений."""
assert NotificationAction.CREATE == NotificationAction.from_string("create")
assert NotificationAction.UPDATE == NotificationAction.from_string("update")
2025-07-25 08:49:12 +03:00
assert NotificationAction.REACT == NotificationAction.from_string("react")
2025-07-25 01:17:23 +03:00
with pytest.raises(ValueError):
NotificationAction.from_string("INVALID_ACTION")