This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user