コード例 #1
0
    def test_delete_education(self):
        """
        Test that we delete Educations which aren't specified in the PATCH
        """
        with mute_signals(post_save):
            education1 = EducationFactory.create()
            EducationFactory.create(profile=education1.profile)
            # has a different profile
            education3 = EducationFactory.create()

        assert education1.profile.education.count() == 2
        education_object1 = EducationSerializer().to_representation(education1)
        serializer = ProfileSerializer(instance=education1.profile,
                                       data={
                                           'education': [education_object1],
                                           'work_history': []
                                       })
        serializer.is_valid(raise_exception=True)
        serializer.save()

        assert education1.profile.education.count() == 1
        assert education1.profile.education.first() == education1

        # Other profile is unaffected
        assert education3.profile.education.count() == 1
コード例 #2
0
    def test_program_enrolled_user_serializer(self):  # pylint: disable=no-self-use
        """
        Asserts the output of the serializer for program-enrolled users (ProgramEnrollments)
        """
        with mute_signals(post_save):
            profile = ProfileFactory.create()
        EducationFactory.create(profile=profile)
        EmploymentFactory.create(profile=profile)
        program = ProgramFactory.create()
        course = CourseFactory.create(program=program)
        course_runs = [
            CourseRunFactory.create(course=course) for _ in range(2)
        ]
        for course_run in course_runs:
            CachedCertificateFactory.create(user=profile.user,
                                            course_run=course_run)
            CachedEnrollmentFactory.create(user=profile.user,
                                           course_run=course_run)
        program_enrollment = ProgramEnrollment.objects.create(
            user=profile.user, program=program)

        assert serialize_program_enrolled_user(program_enrollment) == {
            '_id': program_enrollment.id,
            'id': program_enrollment.id,
            'user_id': profile.user.id,
            'email': profile.user.email,
            'profile': ProfileSerializer().to_representation(profile),
            'program': UserProgramSerializer.serialize(program_enrollment)
        }
コード例 #3
0
 def test_education_add(self, index_type, mock_on_commit):
     """
     Test that Education is indexed after being added
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search(index_type)['total'] == DOC_TYPES_PER_ENROLLMENT
     EducationFactory.create(profile=program_enrollment.user.profile)
     assert_search(es.search(index_type), [program_enrollment], index_type=index_type)
コード例 #4
0
 def test_education_add(self):
     """
     Test that Education is indexed after being added
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search()['total'] == 1
     EducationFactory.create(profile=program_enrollment.user.profile)
     assert_search(es.search(), [program_enrollment])
コード例 #5
0
 def test_education_add(self, index_type, mock_on_commit):
     """
     Test that Education is indexed after being added
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search(index_type)['total'] == DOC_TYPES_PER_ENROLLMENT
     EducationFactory.create(profile=program_enrollment.user.profile)
     assert_search(es.search(index_type), [program_enrollment],
                   index_type=index_type)
コード例 #6
0
 def setUpTestData(cls):
     with mute_signals(post_save):
         cls.profile = ProfileFactory.create()
     EducationFactory.create(profile=cls.profile)
     EmploymentFactory.create(profile=cls.profile)
     EmploymentFactory.create(profile=cls.profile, end_date=None)
     program = ProgramFactory.create()
     course = CourseFactory.create(program=program)
     course_runs = [CourseRunFactory.create(course=course) for _ in range(2)]
     for course_run in course_runs:
         CachedCertificateFactory.create(user=cls.profile.user, course_run=course_run)
         CachedEnrollmentFactory.create(user=cls.profile.user, course_run=course_run)
     cls.program_enrollment = ProgramEnrollment.objects.create(user=cls.profile.user, program=program)
コード例 #7
0
    def test_not_analyzed(self):
        """
        At the moment no string fields in the mapping should be 'analyzed' since there's no field
        supporting full text search.
        """
        program_enrollment = ProgramEnrollmentFactory.create()
        EducationFactory.create(profile=program_enrollment.user.profile)
        EmploymentFactory.create(profile=program_enrollment.user.profile)

        mapping = es.get_mappings()
        nodes = list(traverse_mapping(mapping))
        for node in nodes:
            if node.get('type') == 'string':
                assert node['index'] == 'not_analyzed'
コード例 #8
0
 def setUpTestData(cls):
     """
     Create a profile and social auth
     """
     with mute_signals(post_save):
         cls.profile = ProfileFactory.create(
             filled_out=True,
             agreed_to_terms_of_service=True,
         )
     EmploymentFactory.create(profile=cls.profile)
     EducationFactory.create(profile=cls.profile)
     cls.profile.user.social_auth.create(provider=EdxOrgOAuth2.name,
                                         uid="{}_edx".format(
                                             cls.profile.user.username))
コード例 #9
0
 def setUpTestData(cls):
     """
     Create a profile and social auth
     """
     with mute_signals(post_save):
         cls.profile = ProfileFactory.create(
             filled_out=True,
             agreed_to_terms_of_service=True,
         )
     EmploymentFactory.create(profile=cls.profile)
     EducationFactory.create(profile=cls.profile)
     cls.profile.user.social_auth.create(
         provider=EdxOrgOAuth2.name,
         uid="{}_edx".format(cls.profile.user.username)
     )
コード例 #10
0
    def test_analyzed(self, mock_on_commit):
        """
        Most string fields in the mapping should be 'analyzed' since we don't want to
        tokenize strings arbitrarily when filtering on fields.
        """
        program_enrollment = ProgramEnrollmentFactory.create()
        EducationFactory.create(profile=program_enrollment.user.profile)
        EmploymentFactory.create(profile=program_enrollment.user.profile)

        for index_type in ALL_INDEX_TYPES:
            mapping = es.get_mappings(index_type)
            nodes = list(traverse_mapping(mapping, ""))
            for key, node in nodes:
                if key == "folded":
                    assert node['analyzer'] == "folding"
                elif node.get('type') == 'string':
                    assert node['index'] == 'not_analyzed'
コード例 #11
0
    def test_update_education_different_profile(self):
        """
        Make sure we can't edit an education for a different profile
        """
        with mute_signals(post_save):
            education1 = EducationFactory.create()
            education2 = EducationFactory.create()
        education_object = EducationSerializer(education1).data
        education_object['id'] = education2.id

        serializer = ProfileSerializer(instance=education1.profile, data={
            'education': [education_object], 'work_history': []
        })
        serializer.is_valid(raise_exception=True)
        with self.assertRaises(ValidationError) as ex:
            serializer.save()
        assert ex.exception.detail == ["Education {} does not exist".format(education2.id)]
コード例 #12
0
    def test_analyzed(self, mock_on_commit):
        """
        Most string fields in the mapping should be 'analyzed' since we don't want to
        tokenize strings arbitrarily when filtering on fields.
        """
        program_enrollment = ProgramEnrollmentFactory.create()
        EducationFactory.create(profile=program_enrollment.user.profile)
        EmploymentFactory.create(profile=program_enrollment.user.profile)

        for index_type in ALL_INDEX_TYPES:
            mapping = es.get_mappings(index_type)
            nodes = list(traverse_mapping(mapping, ""))
            for key, node in nodes:
                if key == "folded":
                    assert node['analyzer'] == "folding"
                elif node.get('type') == 'string':
                    assert node['index'] == 'not_analyzed'
コード例 #13
0
 def setUpTestData(cls):
     with mute_signals(post_save):
         profile = ProfileFactory.create()
     EducationFactory.create(profile=profile)
     EmploymentFactory.create(profile=profile)
     program = ProgramFactory.create()
     cls.enrollments = cls._generate_cached_enrollments(profile.user, program, num_course_runs=2)
     certificate_grades = [0.7, 0.8]
     cls.certificates = []
     for i, enrollment in enumerate(cls.enrollments):
         cls.certificates.append(
             CachedCertificateFactory.create(
                 user=profile.user,
                 course_run=enrollment.course_run,
                 data={'grade': certificate_grades[i]}
             )
         )
     cls.program_enrollment = ProgramEnrollment.objects.create(user=profile.user, program=program)
コード例 #14
0
 def setUpTestData(cls):
     with mute_signals(post_save):
         cls.profile = ProfileFactory.create()
     EducationFactory.create(profile=cls.profile)
     EmploymentFactory.create(profile=cls.profile)
     EmploymentFactory.create(profile=cls.profile, end_date=None)
     program = ProgramFactory.create()
     course = CourseFactory.create(program=program)
     course_runs = [
         CourseRunFactory.create(course=course) for _ in range(2)
     ]
     for course_run in course_runs:
         CachedCertificateFactory.create(user=cls.profile.user,
                                         course_run=course_run)
         CachedEnrollmentFactory.create(user=cls.profile.user,
                                        course_run=course_run)
     cls.program_enrollment = ProgramEnrollment.objects.create(
         user=cls.profile.user, program=program)
コード例 #15
0
 def test_education_delete(self, index_type, mock_on_commit):
     """
     Test that Education is removed from index after being deleted
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     education = EducationFactory.create(profile=program_enrollment.user.profile)
     assert_search(es.search(index_type), [program_enrollment], index_type=index_type)
     education.delete()
     assert_search(es.search(index_type), [program_enrollment], index_type=index_type)
コード例 #16
0
 def test_education_update(self, index_type, mock_on_commit):
     """
     Test that Education is reindexed after being updated
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search(index_type)['total'] == DOC_TYPES_PER_ENROLLMENT
     education = EducationFactory.create(profile=program_enrollment.user.profile)
     education.school_city = 'city'
     education.save()
     assert_search(es.search(index_type), [program_enrollment], index_type=index_type)
コード例 #17
0
 def test_education_delete(self):
     """
     Test that Education is removed from index after being deleted
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     education = EducationFactory.create(
         profile=program_enrollment.user.profile)
     assert_search(es.search(), [program_enrollment])
     education.delete()
     assert_search(es.search(), [program_enrollment])
コード例 #18
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
    def test_upload_image(self):
        """
        An image upload should not delete education or work history entries
        """
        with mute_signals(post_save):
            profile = ProfileFactory.create(user=self.user1)
        EducationFactory.create(profile=profile)
        EmploymentFactory.create(profile=profile)
        self.client.force_login(self.user1)

        # create a dummy image file in memory for upload
        with make_temp_image_file(width=50, height=50) as image_file:
            # format patch using multipart upload
            resp = self.client.patch(self.url1, data={
                'image': image_file
            }, format='multipart')

        assert resp.status_code == 200, resp.content.decode('utf-8')
        assert profile.education.count() == 1
        assert profile.work_history.count() == 1
コード例 #19
0
 def test_education_update(self):
     """
     Test that Education is reindexed after being updated
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search()['total'] == 1
     education = EducationFactory.create(
         profile=program_enrollment.user.profile)
     education.school_city = 'city'
     education.save()
     assert_search(es.search(), [program_enrollment])
コード例 #20
0
    def test_upload_image(self):
        """
        An image upload should not delete education or work history entries
        """
        with mute_signals(post_save):
            profile = ProfileFactory.create(user=self.user1)
        EducationFactory.create(profile=profile)
        EmploymentFactory.create(profile=profile)
        self.client.force_login(self.user1)

        # create a dummy image file in memory for upload
        with make_temp_image_file(width=50, height=50) as image_file:
            # format patch using multipart upload
            resp = self.client.patch(self.url1,
                                     data={'image': image_file},
                                     format='multipart')

        assert resp.status_code == 200, resp.content.decode('utf-8')
        assert profile.education.count() == 1
        assert profile.work_history.count() == 1
コード例 #21
0
    def test_folded(self, mock_on_commit):
        """
        Check that we have a folded type for first_name, last_name, and preferred_name
        """
        program_enrollment = ProgramEnrollmentFactory.create()
        EducationFactory.create(profile=program_enrollment.user.profile)
        EmploymentFactory.create(profile=program_enrollment.user.profile)

        for index_type in ALL_INDEX_TYPES:
            mapping = es.get_mappings(index_type)
            properties = mapping[GLOBAL_DOC_TYPE]['properties']
            if index_type == PUBLIC_ENROLLMENT_INDEX_TYPE:
                # Make sure we aren't exposing people's email addresses
                assert 'email' not in properties
            else:
                assert properties['email']['fields']['folded']['analyzer'] == 'folding'

            profile_properties = properties['profile']['properties']
            for key in 'first_name', 'last_name', 'preferred_name', 'full_name', 'username':
                assert profile_properties[key]['fields']['folded']['analyzer'] == 'folding'
コード例 #22
0
 def test_education_update(self, index_type, mock_on_commit):
     """
     Test that Education is reindexed after being updated
     """
     program_enrollment = ProgramEnrollmentFactory.create()
     assert es.search(index_type)['total'] == DOC_TYPES_PER_ENROLLMENT
     education = EducationFactory.create(
         profile=program_enrollment.user.profile)
     education.school_city = 'city'
     education.save()
     assert_search(es.search(index_type), [program_enrollment],
                   index_type=index_type)
コード例 #23
0
    def test_update_education_different_profile(self):
        """
        Make sure we can't edit an education for a different profile
        """
        with mute_signals(post_save):
            education1 = EducationFactory.create()
            education2 = EducationFactory.create()
        education_object = EducationSerializer().to_representation(education1)
        education_object['id'] = education2.id

        serializer = ProfileSerializer(instance=education1.profile,
                                       data={
                                           'education': [education_object],
                                           'work_history': []
                                       })
        serializer.is_valid(raise_exception=True)
        with self.assertRaises(ValidationError) as ex:
            serializer.save()
        assert ex.exception.detail == [
            "Education {} does not exist".format(education2.id)
        ]
コード例 #24
0
    def test_folded(self, mock_on_commit):
        """
        Check that we have a folded type for first_name, last_name, and preferred_name
        """
        program_enrollment = ProgramEnrollmentFactory.create()
        EducationFactory.create(profile=program_enrollment.user.profile)
        EmploymentFactory.create(profile=program_enrollment.user.profile)

        for index_type in ALL_INDEX_TYPES:
            mapping = es.get_mappings(index_type)
            properties = mapping[GLOBAL_DOC_TYPE]['properties']
            if index_type == PUBLIC_ENROLLMENT_INDEX_TYPE:
                # Make sure we aren't exposing people's email addresses
                assert 'email' not in properties
            else:
                assert properties['email']['fields']['folded'][
                    'analyzer'] == 'folding'

            profile_properties = properties['profile']['properties']
            for key in 'first_name', 'last_name', 'preferred_name', 'full_name', 'username':
                assert profile_properties[key]['fields']['folded'][
                    'analyzer'] == 'folding'
コード例 #25
0
    def test_delete_education(self):
        """
        Test that we delete Educations which aren't specified in the PATCH
        """
        with mute_signals(post_save):
            education1 = EducationFactory.create()
            EducationFactory.create(profile=education1.profile)
            # has a different profile
            education3 = EducationFactory.create()

        assert education1.profile.education.count() == 2
        education_object1 = EducationSerializer(education1).data
        serializer = ProfileSerializer(instance=education1.profile, data={
            'education': [education_object1], 'work_history': []
        })
        serializer.is_valid(raise_exception=True)
        serializer.save()

        assert education1.profile.education.count() == 1
        assert education1.profile.education.first() == education1

        # Other profile is unaffected
        assert education3.profile.education.count() == 1
コード例 #26
0
    def test_update_education(self):
        """
        Test that we handle updating an Education correctly
        """
        with mute_signals(post_save):
            education = EducationFactory.create()
        education_data = EducationSerializer(education).data
        education_data['degree_name'] = BACHELORS

        serializer = ProfileSerializer(instance=education.profile, data={
            'education': [education_data], 'work_history': []
        })
        serializer.is_valid(raise_exception=True)
        serializer.save()

        assert education.profile.education.count() == 1
        education = education.profile.education.first()
        assert EducationSerializer(education).data == education_data
コード例 #27
0
    def test_update_education(self):
        """
        Test that we handle updating an Education correctly
        """
        with mute_signals(post_save):
            education = EducationFactory.create()
        education_data = EducationSerializer(education).data
        education_data['degree_name'] = BACHELORS

        serializer = ProfileSerializer(instance=education.profile,
                                       data={
                                           'education': [education_data],
                                           'work_history': []
                                       })
        serializer.is_valid(raise_exception=True)
        serializer.save()

        assert education.profile.education.count() == 1
        education = education.profile.education.first()
        assert EducationSerializer(education).data == education_data
コード例 #28
0
ファイル: test_api.py プロジェクト: pogasanov/clsite
    def test_update_and_add_education_data(self):
        self.user.education_set.all().delete()
        existing_educations = EducationFactory.create_batch(profile=self.user,
                                                            size=2)
        UPDATED_EDUCATION_PAYLOAD = [
            {
                "id": existing_educations[0].id,
                "school": "Dummy school1",
                "degree": "Dummy degree1",
                "graduation_date": "2010-10-16",
            },
            {
                "id": existing_educations[1].id,
                "school": "Dummy school2",
                "degree": "Dummy degree2",
                "graduation_date": "2011-10-16",
            },
            {
                "school": "Dummy school3",
                "degree": "Dummy degree3",
                "graduation_date": "2012-10-16"
            },
            {
                "school": "Dummy school4",
                "degree": "Dummy degree4",
                "graduation_date": "2014-10-16"
            },
        ]

        response = self.client.patch(self.VIEW_URL,
                                     {"educations": UPDATED_EDUCATION_PAYLOAD})
        self.assertEqual(response.status_code, 200)
        educations = self.user.education_set.all()
        self.assertEqual(len(educations), 4)
        for education in educations:
            if education.school == "Dummy school1":
                self.assertEqual(education.id, existing_educations[0].id)
            if education.school == "Dummy school2":
                self.assertEqual(education.id, existing_educations[1].id)
コード例 #29
0
 def setUpTestData(cls):
     with mute_signals(post_save):
         cls.profile = profile = ProfileFactory.create()
     cls.user = profile.user
     EducationFactory.create(profile=profile)
     EmploymentFactory.create(profile=profile)
     # create a normal program
     program = ProgramFactory.create()
     cls.enrollments = cls._generate_cached_enrollments(cls.user, program, num_course_runs=2)
     certificate_grades_vals = [0.7, 0.8]
     cls.current_grades_vals = [0.9, 1.0]
     cls.certificates = []
     cls.current_grades = []
     for i, enrollment in enumerate(cls.enrollments):
         cls.certificates.append(
             CachedCertificateFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "grade": certificate_grades_vals[i],
                     "certificate_type": "verified",
                     "course_id": enrollment.course_run.edx_course_key,
                     "status": "downloadable",
                 }
             )
         )
         cls.current_grades.append(
             CachedCurrentGradeFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "passed": True,
                     "percent": cls.current_grades_vals[i],
                     "course_key": enrollment.course_run.edx_course_key,
                 }
             )
         )
         FinalGradeFactory.create(
             user=cls.user,
             course_run=enrollment.course_run,
             grade=certificate_grades_vals[i],
             passed=True,
         )
     non_fa_cached_edx_data = CachedEdxUserData(cls.user, program=program)
     non_fa_mmtrack = MMTrack(cls.user, program, non_fa_cached_edx_data)
     cls.serialized_enrollments = UserProgramSearchSerializer.serialize_enrollments(non_fa_mmtrack)
     cls.serialized_course_enrollments = UserProgramSearchSerializer.serialize_course_enrollments(non_fa_mmtrack)
     cls.semester_enrollments = UserProgramSearchSerializer.serialize_course_runs_enrolled(non_fa_mmtrack)
     cls.program_enrollment = ProgramEnrollment.objects.create(user=cls.user, program=program)
     # create a financial aid program
     cls.fa_program, _ = create_program()
     cls.fa_program_enrollment = ProgramEnrollment.objects.create(user=cls.user, program=cls.fa_program)
     cls.fa_enrollments = cls._generate_cached_enrollments(cls.user, cls.fa_program, num_course_runs=2)
     cls.current_grades = []
     for i, enrollment in enumerate(cls.fa_enrollments):
         order = OrderFactory.create(user=cls.user, status='fulfilled')
         LineFactory.create(order=order, course_key=enrollment.course_run.edx_course_key)
         cls.current_grades.append(
             CachedCurrentGradeFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "passed": True,
                     "percent": cls.current_grades_vals[i],
                     "course_key": enrollment.course_run.edx_course_key,
                 }
             )
         )
         FinalGradeFactory.create(
             user=cls.user,
             course_run=enrollment.course_run,
             grade=cls.current_grades_vals[i],
             passed=True,
         )
     fa_cached_edx_data = CachedEdxUserData(cls.user, program=cls.fa_program)
     fa_mmtrack = MMTrack(cls.user, cls.fa_program, fa_cached_edx_data)
     cls.fa_serialized_course_enrollments = (
         UserProgramSearchSerializer.serialize_course_enrollments(fa_mmtrack)
     )
     cls.fa_serialized_enrollments = (
         UserProgramSearchSerializer.serialize_enrollments(fa_mmtrack)
     )
コード例 #30
0
 def setUpTestData(cls):
     with mute_signals(post_save):
         cls.profile = profile = ProfileFactory.create()
     cls.user = profile.user
     EducationFactory.create(profile=profile)
     EmploymentFactory.create(profile=profile)
     # create a normal program
     program = ProgramFactory.create()
     cls.enrollments = cls._generate_cached_enrollments(cls.user,
                                                        program,
                                                        num_course_runs=2)
     certificate_grades_vals = [0.7, 0.8]
     cls.current_grades_vals = [0.9, 1.0]
     cls.certificates = []
     cls.current_grades = []
     for i, enrollment in enumerate(cls.enrollments):
         cls.certificates.append(
             CachedCertificateFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "grade": certificate_grades_vals[i],
                     "certificate_type": "verified",
                     "course_id": enrollment.course_run.edx_course_key,
                     "status": "downloadable",
                 }))
         cls.current_grades.append(
             CachedCurrentGradeFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "passed": True,
                     "percent": cls.current_grades_vals[i],
                     "course_key": enrollment.course_run.edx_course_key,
                 }))
         FinalGradeFactory.create(
             user=cls.user,
             course_run=enrollment.course_run,
             grade=certificate_grades_vals[i],
             passed=True,
         )
     non_fa_cached_edx_data = CachedEdxUserData(cls.user, program=program)
     non_fa_mmtrack = MMTrack(cls.user, program, non_fa_cached_edx_data)
     cls.serialized_enrollments = UserProgramSearchSerializer.serialize_enrollments(
         non_fa_mmtrack)
     cls.serialized_course_enrollments = UserProgramSearchSerializer.serialize_course_enrollments(
         non_fa_mmtrack)
     cls.semester_enrollments = UserProgramSearchSerializer.serialize_course_runs_enrolled(
         non_fa_mmtrack)
     cls.program_enrollment = ProgramEnrollment.objects.create(
         user=cls.user, program=program)
     # create a financial aid program
     cls.fa_program, _ = create_program()
     cls.fa_program_enrollment = ProgramEnrollment.objects.create(
         user=cls.user, program=cls.fa_program)
     cls.fa_enrollments = cls._generate_cached_enrollments(
         cls.user, cls.fa_program, num_course_runs=2)
     cls.current_grades = []
     for i, enrollment in enumerate(cls.fa_enrollments):
         order = OrderFactory.create(user=cls.user, status='fulfilled')
         LineFactory.create(order=order,
                            course_key=enrollment.course_run.edx_course_key)
         cls.current_grades.append(
             CachedCurrentGradeFactory.create(
                 user=cls.user,
                 course_run=enrollment.course_run,
                 data={
                     "passed": True,
                     "percent": cls.current_grades_vals[i],
                     "course_key": enrollment.course_run.edx_course_key,
                 }))
         FinalGradeFactory.create(
             user=cls.user,
             course_run=enrollment.course_run,
             grade=cls.current_grades_vals[i],
             passed=True,
         )
     fa_cached_edx_data = CachedEdxUserData(cls.user,
                                            program=cls.fa_program)
     fa_mmtrack = MMTrack(cls.user, cls.fa_program, fa_cached_edx_data)
     cls.fa_serialized_course_enrollments = (
         UserProgramSearchSerializer.serialize_course_enrollments(
             fa_mmtrack))
     cls.fa_serialized_enrollments = (
         UserProgramSearchSerializer.serialize_enrollments(fa_mmtrack))