Unit tests for "_add_upsell_button_to_email_template".
This commit is contained in:
committed by
Calen Pennington
parent
d571adfb99
commit
40d3f4f2fc
@@ -237,18 +237,18 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
|
||||
# # of sql queries to default,
|
||||
# # of mongo queries,
|
||||
# )
|
||||
('no_overrides', 1, True, False): (18, 1),
|
||||
('no_overrides', 2, True, False): (18, 1),
|
||||
('no_overrides', 3, True, False): (18, 1),
|
||||
('ccx', 1, True, False): (18, 1),
|
||||
('ccx', 2, True, False): (18, 1),
|
||||
('ccx', 3, True, False): (18, 1),
|
||||
('no_overrides', 1, False, False): (18, 1),
|
||||
('no_overrides', 2, False, False): (18, 1),
|
||||
('no_overrides', 3, False, False): (18, 1),
|
||||
('ccx', 1, False, False): (18, 1),
|
||||
('ccx', 2, False, False): (18, 1),
|
||||
('ccx', 3, False, False): (18, 1),
|
||||
('no_overrides', 1, True, False): (16, 1),
|
||||
('no_overrides', 2, True, False): (16, 1),
|
||||
('no_overrides', 3, True, False): (16, 1),
|
||||
('ccx', 1, True, False): (16, 1),
|
||||
('ccx', 2, True, False): (16, 1),
|
||||
('ccx', 3, True, False): (16, 1),
|
||||
('no_overrides', 1, False, False): (16, 1),
|
||||
('no_overrides', 2, False, False): (16, 1),
|
||||
('no_overrides', 3, False, False): (16, 1),
|
||||
('ccx', 1, False, False): (16, 1),
|
||||
('ccx', 2, False, False): (16, 1),
|
||||
('ccx', 3, False, False): (16, 1),
|
||||
}
|
||||
|
||||
|
||||
@@ -260,19 +260,19 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
|
||||
__test__ = True
|
||||
|
||||
TEST_DATA = {
|
||||
('no_overrides', 1, True, False): (18, 3),
|
||||
('no_overrides', 2, True, False): (18, 3),
|
||||
('no_overrides', 3, True, False): (18, 3),
|
||||
('ccx', 1, True, False): (18, 3),
|
||||
('ccx', 2, True, False): (18, 3),
|
||||
('ccx', 3, True, False): (18, 3),
|
||||
('ccx', 1, True, True): (19, 3),
|
||||
('ccx', 2, True, True): (19, 3),
|
||||
('ccx', 3, True, True): (19, 3),
|
||||
('no_overrides', 1, False, False): (18, 3),
|
||||
('no_overrides', 2, False, False): (18, 3),
|
||||
('no_overrides', 3, False, False): (18, 3),
|
||||
('ccx', 1, False, False): (18, 3),
|
||||
('ccx', 2, False, False): (18, 3),
|
||||
('ccx', 3, False, False): (18, 3),
|
||||
('no_overrides', 1, True, False): (16, 3),
|
||||
('no_overrides', 2, True, False): (16, 3),
|
||||
('no_overrides', 3, True, False): (16, 3),
|
||||
('ccx', 1, True, False): (16, 3),
|
||||
('ccx', 2, True, False): (16, 3),
|
||||
('ccx', 3, True, False): (16, 3),
|
||||
('ccx', 1, True, True): (17, 3),
|
||||
('ccx', 2, True, True): (17, 3),
|
||||
('ccx', 3, True, True): (17, 3),
|
||||
('no_overrides', 1, False, False): (16, 3),
|
||||
('no_overrides', 2, False, False): (16, 3),
|
||||
('no_overrides', 3, False, False): (16, 3),
|
||||
('ccx', 1, False, False): (16, 3),
|
||||
('ccx', 2, False, False): (16, 3),
|
||||
('ccx', 3, False, False): (16, 3),
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ def verified_upgrade_deadline_link(user, course=None, course_id=None):
|
||||
course_id (:class:`.CourseKey`): The course_id of the course to render for.
|
||||
|
||||
Returns:
|
||||
The formatted link to that will allow the user to upgrade to verified
|
||||
The formatted link that will allow the user to upgrade to verified
|
||||
in this course.
|
||||
"""
|
||||
if course is not None:
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('courseware', '0003_auto_20170825_0935'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='coursedynamicupgradedeadlineconfiguration',
|
||||
name='opt_out',
|
||||
field=models.BooleanField(default=False, help_text='Disable the dynamic upgrade deadline for this course run.'),
|
||||
),
|
||||
]
|
||||
@@ -398,5 +398,5 @@ class CourseDynamicUpgradeDeadlineConfiguration(ConfigurationModel):
|
||||
)
|
||||
opt_out = models.BooleanField(
|
||||
default=False,
|
||||
help_text=_('This does not do anything and is no longer used. Setting enabled=False has the same effect.')
|
||||
help_text=_('Disable the dynamic upgrade deadline for this course run.')
|
||||
)
|
||||
|
||||
@@ -617,18 +617,6 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
|
||||
block = VerifiedUpgradeDeadlineDate(course, enrollment.user)
|
||||
self.assertEqual(block.date, expected)
|
||||
|
||||
@override_waffle_flag(CREATE_SCHEDULE_WAFFLE_FLAG, True)
|
||||
def test_date_with_self_paced_with_single_course(self):
|
||||
""" If the global switch is off, a single course can still be enabled. """
|
||||
course = create_self_paced_course_run(days_till_start=-1)
|
||||
DynamicUpgradeDeadlineConfiguration.objects.create(enabled=False)
|
||||
course_config = CourseDynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, course_id=course.id)
|
||||
enrollment = CourseEnrollmentFactory(course_id=course.id, mode=CourseMode.AUDIT)
|
||||
|
||||
block = VerifiedUpgradeDeadlineDate(course, enrollment.user)
|
||||
expected = enrollment.created + timedelta(days=course_config.deadline_days)
|
||||
self.assertEqual(block.date, expected)
|
||||
|
||||
@override_waffle_flag(CREATE_SCHEDULE_WAFFLE_FLAG, True)
|
||||
def test_date_with_existing_schedule(self):
|
||||
""" If a schedule is created while deadlines are disabled, they shouldn't magically appear once the feature is
|
||||
|
||||
@@ -213,8 +213,8 @@ class IndexQueryTestCase(ModuleStoreTestCase):
|
||||
NUM_PROBLEMS = 20
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 10, 146),
|
||||
(ModuleStoreEnum.Type.split, 4, 146),
|
||||
(ModuleStoreEnum.Type.mongo, 10, 145),
|
||||
(ModuleStoreEnum.Type.split, 4, 145),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_index_query_counts(self, store_type, expected_mongo_query_count, expected_mysql_query_count):
|
||||
@@ -1457,13 +1457,13 @@ class ProgressPageTests(ProgressPageBaseTests):
|
||||
"""Test that query counts remain the same for self-paced and instructor-paced courses."""
|
||||
SelfPacedConfiguration(enabled=self_paced_enabled).save()
|
||||
self.setup_course(self_paced=self_paced)
|
||||
with self.assertNumQueries(35, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST), check_mongo_calls(1):
|
||||
with self.assertNumQueries(34 if self_paced else 33, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST), check_mongo_calls(1):
|
||||
self._get_progress_page()
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS': False})
|
||||
@ddt.data(
|
||||
(False, 42, 26),
|
||||
(True, 35, 22)
|
||||
(False, 40, 26),
|
||||
(True, 33, 22)
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_progress_queries(self, enable_waffle, initial, subsequent):
|
||||
|
||||
Reference in New Issue
Block a user