diff --git a/common/djangoapps/util/tests/test_date_utils.py b/common/djangoapps/util/tests/test_date_utils.py index 2e64ae622d4a5185cb24f12d1af816663365e5b3..2e7c581a700c93d4b524bc080fc7315180a5f883 100644 --- a/common/djangoapps/util/tests/test_date_utils.py +++ b/common/djangoapps/util/tests/test_date_utils.py @@ -6,11 +6,14 @@ import unittest from datetime import datetime, timedelta, tzinfo from unittest.mock import patch +import crum import ddt import pytest from markupsafe import Markup from pytz import utc +from django.test.client import RequestFactory + from common.djangoapps.util.date_utils import ( almost_same_datetime, get_default_time_display, get_time_display, strftime_localized, strftime_localized_html ) @@ -217,6 +220,12 @@ class StrftimeLocalizedHtmlTest(unittest.TestCase): """ Tests for strftime_localized_html. """ + def setUp(self): + super().setUp() + request = RequestFactory().request() + self.addCleanup(crum.set_current_request, None) + crum.set_current_request(request) + @ddt.data( None, 'Africa/Casablanca',