21 lines
630 B
Python
21 lines
630 B
Python
from unittest.mock import patch
|
|
|
|
from django.conf import settings
|
|
from django.test import TestCase
|
|
|
|
from apps.notifications.tasks import cleanup_redis_notifications
|
|
|
|
|
|
class NotificationTaskTests(TestCase):
|
|
@patch("apps.notifications.tasks.RedisNotificationStore.cleanup_expired")
|
|
def test_cleanup_redis_notifications_uses_settings_retention_days(self, cleanup_expired):
|
|
cleanup_expired.return_value = 7
|
|
|
|
removed = cleanup_redis_notifications()
|
|
|
|
self.assertEqual(removed, 7)
|
|
cleanup_expired.assert_called_once_with(
|
|
retention_days=settings.NOTIFICATION_RETENTION_DAYS
|
|
)
|
|
|