From a72df1f9d533feebd075ea0845c1f9c29bfe9dc5 Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Thu, 26 Oct 2017 09:13:29 -0400 Subject: [PATCH] Add _get_dates helper method to the schedules management command base test class --- .../schedules/management/commands/tests/tools.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/tools.py b/openedx/core/djangoapps/schedules/management/commands/tests/tools.py index bb6ad3f20c..cab728af0b 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/tools.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/tools.py @@ -17,6 +17,7 @@ from opaque_keys.edx.keys import CourseKey from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory, SiteFactory from openedx.core.djangoapps.schedules import resolvers, tasks +from openedx.core.djangoapps.schedules.resolvers import _get_datetime_beginning_of_day from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory, ScheduleFactory from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, FilteredQueryCountMixin @@ -83,6 +84,12 @@ class ScheduleBaseEmailTestBase(SharedModuleStoreTestCase): def _calculate_bin_for_user(self, user): return user.id % self.tested_task.num_bins + def _get_dates(self, offset=None): + current_day = _get_datetime_beginning_of_day(datetime.datetime.now(pytz.UTC)) + offset = offset or self.expected_offsets[0] + target_day = current_day + datetime.timedelta(days=offset) + return current_day, offset, target_day + def _get_template_overrides(self): templates_override = deepcopy(settings.TEMPLATES) templates_override[0]['OPTIONS']['string_if_invalid'] = "TEMPLATE WARNING - MISSING VARIABLE [%s]"