Commit f1ceb86f by Nimisha Asthagiri

Remove unneeded imports/etc from schedules management command test classes

parent 185f35b1
import datetime import datetime
import itertools
from unittest import skipUnless from unittest import skipUnless
import ddt import ddt
import pytz
from django.conf import settings from django.conf import settings
from edx_ace.utils.date import serialize from edx_ace.utils.date import serialize
from edx_ace.message import Message from edx_ace.message import Message
from mock import Mock, patch from mock import patch
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
import pytz
from course_modes.models import CourseMode from course_modes.models import CourseMode
from course_modes.tests.factories import CourseModeFactory from course_modes.tests.factories import CourseModeFactory
from courseware.models import DynamicUpgradeDeadlineConfiguration from courseware.models import DynamicUpgradeDeadlineConfiguration
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory from openedx.core.djangoapps.schedules import tasks
from openedx.core.djangoapps.schedules import resolvers, tasks
from openedx.core.djangoapps.schedules.management.commands import send_recurring_nudge as nudge from openedx.core.djangoapps.schedules.management.commands import send_recurring_nudge as nudge
from openedx.core.djangoapps.schedules.management.commands.tests.tools import ScheduleBaseEmailTestBase from openedx.core.djangoapps.schedules.management.commands.tests.tools import ScheduleBaseEmailTestBase
from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory, ScheduleFactory from openedx.core.djangoapps.schedules.tests.factories import ScheduleFactory
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms, FilteredQueryCountMixin
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
...@@ -167,5 +162,4 @@ class TestSendRecurringNudge(ScheduleBaseEmailTestBase): ...@@ -167,5 +162,4 @@ class TestSendRecurringNudge(ScheduleBaseEmailTestBase):
def _contains_upsell_attribute(self, msg_attr): def _contains_upsell_attribute(self, msg_attr):
msg = Message.from_string(msg_attr) msg = Message.from_string(msg_attr)
tmp = msg.context["show_upsell"]
return msg.context["show_upsell"] return msg.context["show_upsell"]
import datetime
import logging import logging
from unittest import skipUnless from unittest import skipUnless
import ddt import ddt
import pytz
from django.conf import settings from django.conf import settings
from edx_ace import Message from edx_ace import Message
from edx_ace.utils.date import serialize from edx_ace.utils.date import serialize
from mock import Mock, patch from mock import Mock, patch
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
from course_modes.models import CourseMode from course_modes.models import CourseMode
from course_modes.tests.factories import CourseModeFactory from openedx.core.djangoapps.schedules import tasks
from openedx.core.djangoapps.schedules import resolvers, tasks
from openedx.core.djangoapps.schedules.management.commands import send_upgrade_reminder as reminder from openedx.core.djangoapps.schedules.management.commands import send_upgrade_reminder as reminder
from openedx.core.djangoapps.schedules.management.commands.tests.tools import ScheduleBaseEmailTestBase from openedx.core.djangoapps.schedules.management.commands.tests.tools import ScheduleBaseEmailTestBase
from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory, ScheduleFactory from openedx.core.djangoapps.schedules.tests.factories import ScheduleFactory
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.core.djangolib.testing.utils import skip_unless_lms from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
...@@ -42,15 +36,6 @@ class TestUpgradeReminder(ScheduleBaseEmailTestBase): ...@@ -42,15 +36,6 @@ class TestUpgradeReminder(ScheduleBaseEmailTestBase):
has_course_queries = True has_course_queries = True
def setUp(self):
super(TestUpgradeReminder, self).setUp()
CourseModeFactory(
course_id=self.course.id,
mode_slug=CourseMode.VERIFIED,
expiration_datetime=datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=30),
)
@ddt.data(True, False) @ddt.data(True, False)
@patch.object(tasks, 'ace') @patch.object(tasks, 'ace')
def test_verified_learner(self, is_verified, mock_ace): def test_verified_learner(self, is_verified, mock_ace):
......
...@@ -14,16 +14,13 @@ from edx_ace.channel import ChannelType ...@@ -14,16 +14,13 @@ from edx_ace.channel import ChannelType
from edx_ace.utils.date import serialize from edx_ace.utils.date import serialize
from edx_ace.test_utils import StubPolicy, patch_channels, patch_policies from edx_ace.test_utils import StubPolicy, patch_channels, patch_policies
from opaque_keys.edx.keys import CourseKey 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.site_configuration.tests.factories import SiteConfigurationFactory, SiteFactory
from openedx.core.djangoapps.schedules import resolvers, tasks 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.resolvers import _get_datetime_beginning_of_day
from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory, ScheduleFactory from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory, ScheduleFactory
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, FilteredQueryCountMixin
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
SITE_QUERY = 1 SITE_QUERY = 1
...@@ -59,19 +56,6 @@ class ScheduleBaseEmailTestBase(SharedModuleStoreTestCase): ...@@ -59,19 +56,6 @@ class ScheduleBaseEmailTestBase(SharedModuleStoreTestCase):
has_course_queries = False has_course_queries = False
@classmethod
def setUpClass(cls):
super(ScheduleBaseEmailTestBase, cls).setUpClass()
cls.course = CourseFactory.create(
org='edX',
number='test',
display_name='Test Course',
self_paced=True,
start=datetime.datetime.now(pytz.UTC) - datetime.timedelta(days=30),
)
cls.course_overview = CourseOverview.get_from_id(cls.course.id)
def setUp(self): def setUp(self):
super(ScheduleBaseEmailTestBase, self).setUp() super(ScheduleBaseEmailTestBase, self).setUp()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment