test(backend): add coverage for services tasks and apis
This commit is contained in:
20
apps/notifications/tests/test_tasks.py
Normal file
20
apps/notifications/tests/test_tasks.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user