feat: Pass segment properties (#30742)

- For enrollment email pass extra segment event properties.
VAN-999
This commit is contained in:
Mubbshar Anwar
2022-08-29 15:36:24 +05:00
committed by GitHub
parent 3b978c4157
commit b76d5c2a66
15 changed files with 435 additions and 21 deletions

View File

@@ -76,6 +76,11 @@ class FieldOverridePerformanceTestCase(FieldOverrideTestMixin, ProceduralCourseT
self.course = None
self.ccx = None
patch_context = mock.patch('common.djangoapps.student.helpers.get_course_dates_for_email')
get_course = patch_context.start()
get_course.return_value = []
self.addCleanup(patch_context.stop)
def setup_course(self, size, enable_ccx, view_as_ccx):
"""
Build a gradable course where each node has `size` children.

View File

@@ -46,6 +46,10 @@ class OutlineTabTestViews(BaseCourseHomeTests):
def setUp(self):
super().setUp()
self.url = reverse('course-home:outline-tab', args=[self.course.id])
patch_context = patch('common.djangoapps.student.helpers.get_course_dates_for_email')
get_course = patch_context.start()
get_course.return_value = []
self.addCleanup(patch_context.stop)
def update_course_and_overview(self):
self.update_course(self.course, self.user.id)

View File

@@ -47,6 +47,11 @@ class ProgressTabTestViews(BaseCourseHomeTests):
super().setUp()
self.url = reverse('course-home:progress-tab', args=[self.course.id])
patch_context = patch('common.djangoapps.student.helpers.get_course_dates_for_email')
get_course = patch_context.start()
get_course.return_value = []
self.addCleanup(patch_context.stop)
def add_subsection_with_problem(self, **kwargs):
"""Makes a chapter -> problem chain, and sets up the subsection as requested, returning the problem"""
chapter = ItemFactory(parent=self.course, category='chapter')

View File

@@ -338,8 +338,10 @@ class IndexQueryTestCase(ModuleStoreTestCase):
"""
NUM_PROBLEMS = 20
def test_index_query_counts(self):
@patch('common.djangoapps.student.helpers.get_course_dates_for_email')
def test_index_query_counts(self, mock_course_dates_for_email):
# TODO: decrease query count as part of REVO-28
mock_course_dates_for_email.return_value = []
ContentTypeGatingConfig.objects.create(enabled=True, enabled_as_of=datetime(2018, 1, 1))
with self.store.default_store(ModuleStoreEnum.Type.split):
course = CourseFactory.create()
@@ -350,6 +352,20 @@ class IndexQueryTestCase(ModuleStoreTestCase):
for _ in range(self.NUM_PROBLEMS):
ItemFactory.create(category='problem', parent_location=vertical.location)
course_run = CourseRunFactory.create(key=course.id)
course_run['title'] = course.display_name
course_run['short_description'] = None
course_run['marketing_url'] = 'www.edx.org'
course_run['pacing_type'] = 'self_paced'
course_run['banner_image_url'] = ''
course_run['min_effort'] = 1
course_run['enrollment_count'] = 12345
patch_course_data = patch('openedx.core.djangoapps.catalog.api.get_course_run_details')
course_data = patch_course_data.start()
course_data.return_value = course_run
self.addCleanup(patch_course_data.stop)
self.client.login(username=self.user.username, password=self.user_password)
CourseEnrollment.enroll(self.user, course.id)

View File

@@ -31,6 +31,16 @@ class TestCourseGradeFactory(GradeTestBase):
"""
Test that CourseGrades are calculated properly
"""
def setUp(self):
"""
setup tests
"""
patch_context = patch('common.djangoapps.student.helpers.get_course_dates_for_email')
get_course = patch_context.start()
get_course.return_value = []
super().setUp()
self.addCleanup(patch_context.stop)
def _assert_zero_grade(self, course_grade, expected_grade_class):
"""
Asserts whether the given course_grade is as expected with

View File

@@ -374,7 +374,9 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
(ModuleStoreEnum.Type.split, 2, 48),
)
@ddt.unpack
def test_query_counts(self, store_type, mongo_count, expected_query_count):
@patch('common.djangoapps.student.helpers.get_course_dates_for_email')
def test_query_counts(self, store_type, mongo_count, expected_query_count, mock_course_dates_for_email):
mock_course_dates_for_email.return_value = []
with self.store.default_store(store_type):
experiment_group_a = Group(2, 'Expériment Group A')
experiment_group_b = Group(3, 'Expériment Group B')