From 346a2bcf2a1a09c54a69da2ef365922602b0863e Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Thu, 26 Oct 2017 09:11:03 -0400 Subject: [PATCH] Move _calculate_bin_for_user into the schedules management command base test class --- .../management/commands/tests/test_send_recurring_nudge.py | 3 --- .../management/commands/tests/test_send_upgrade_reminder.py | 3 --- .../djangoapps/schedules/management/commands/tests/tools.py | 3 +++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py index 14aa3598c5..8c9f5e1f35 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py @@ -178,9 +178,6 @@ class TestSendRecurringNudge(ScheduleBaseEmailTestBase): return sent_messages - def _calculate_bin_for_user(self, user): - return user.id % resolvers.RECURRING_NUDGE_NUM_BINS - def _contains_upsell_attribute(self, msg_attr): msg = Message.from_string(msg_attr) tmp = msg.context["show_upsell"] diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py index 5d8c10de88..1ae9e64647 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py @@ -71,9 +71,6 @@ class TestUpgradeReminder(ScheduleBaseEmailTestBase): expiration_datetime=datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=30), ) - def _calculate_bin_for_user(self, user): - return user.id % resolvers.UPGRADE_REMINDER_NUM_BINS - @patch.object(tasks, '_upgrade_reminder_schedule_send') def test_dont_send_to_verified_learner(self, mock_schedule_send): upgrade_deadline = datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=2) diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/tools.py b/openedx/core/djangoapps/schedules/management/commands/tests/tools.py index 0f8e55c0a4..bb6ad3f20c 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/tools.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/tools.py @@ -80,6 +80,9 @@ class ScheduleBaseEmailTestBase(SharedModuleStoreTestCase): DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True) + def _calculate_bin_for_user(self, user): + return user.id % self.tested_task.num_bins + def _get_template_overrides(self): templates_override = deepcopy(settings.TEMPLATES) templates_override[0]['OPTIONS']['string_if_invalid'] = "TEMPLATE WARNING - MISSING VARIABLE [%s]"