Exemple #1
0
    def test_get_learner_data_record(self, completed_date, is_passing):
        """
        The base ``get_learner_data_record`` method returns a ``LearnerDataTransmissionAudit`` with appropriate values.
        """
        enterprise_course_enrollment = factories.EnterpriseCourseEnrollmentFactory(
            enterprise_customer_user=self.enterprise_customer_user,
            course_id=self.course_id,
        )
        exporter = DegreedLearnerExporter('fake-user', self.config)
        learner_data_records = exporter.get_learner_data_records(
            enterprise_course_enrollment,
            completed_date=completed_date,
            is_passing=is_passing,
        )
        assert len(learner_data_records) == 2
        assert learner_data_records[0].course_id == self.course_key
        assert learner_data_records[1].course_id == self.course_id

        for learner_data_record in learner_data_records:
            assert learner_data_record.enterprise_course_enrollment_id == enterprise_course_enrollment.id
            assert learner_data_record.degreed_user_email == '*****@*****.**'
            assert learner_data_record.course_completed == (completed_date
                                                            is not None
                                                            and is_passing)
            assert learner_data_record.completed_timestamp == (
                self.NOW.strftime('%F')
                if completed_date is not None else None)
Exemple #2
0
 def test_no_remote_id(self):
     """
     If the TPA API Client returns no remote user ID, nothing is returned.
     """
     self.tpa_client.return_value.get_remote_id.return_value = None
     exporter = DegreedLearnerExporter('fake-user', self.config)
     assert exporter.get_learner_data_records(factories.EnterpriseCourseEnrollmentFactory()) is None
Exemple #3
0
 def get_learner_data_exporter(self, user):
     """
     Return a ``DegreedLearnerDataExporter`` instance.
     """
     return DegreedLearnerExporter(user, self)