コード例 #1
0
    def test_transmit_course_enrollments_transmit_fail_skip(self, mock_send_statement):
        # pylint: disable=import-outside-toplevel
        from integrated_channels.xapi.management.commands.send_course_enrollments import Command

        lrs_configuration = factories.XAPILRSConfigurationFactory()
        user = factories.UserFactory()
        course = self.course_overview

        Command.transmit_courserun_enrollment_statement(lrs_configuration, user, course)
        assert mock_send_statement.called
コード例 #2
0
    def test_save_xapi_learner_data_transmission_audit(self):
        # pylint: disable=import-outside-toplevel
        from integrated_channels.xapi.management.commands.send_course_enrollments import Command

        Command.save_xapi_learner_data_transmission_audit(
            factories.UserFactory(),
            'course-v1:edX+DemoX+Demo_Course',
            42,
            status=200,
            error_message=None
        )
コード例 #3
0
    def test_is_already_transmitted(self):
        # pylint: disable=import-outside-toplevel
        from integrated_channels.xapi.management.commands.send_course_enrollments import Command

        user_id = 12
        course_id = 'course-v1:edX+DemoX+Demo_Course'
        xapi_transmissions = mock.MagicMock()
        xapi_transmissions.filter.return_value = [
            mock.MagicMock(user_id=user_id, course_id=course_id)
        ]

        Command.is_already_transmitted(xapi_transmissions, user_id, course_id)
コード例 #4
0
    def test_save_xapi_learner_data_transmission_audit_preexisting(self, mock_transmission_audit):
        # pylint: disable=import-outside-toplevel
        from integrated_channels.xapi.management.commands.send_course_enrollments import Command

        mock_transmission_audit.objects.get_or_create.return_value = (mock.MagicMock(), False)
        Command.save_xapi_learner_data_transmission_audit(
            factories.UserFactory(),
            'course-v1:edX+DemoX+Demo_Course',
            42,
            status=200,
            error_message=None
        )
コード例 #5
0
    def test_get_pertinent_course_enrollments_no_enrollments(self):
        # pylint: disable=import-outside-toplevel
        from integrated_channels.xapi.management.commands.send_course_enrollments import Command

        course_id = 'course-v1:edX+DemoX+Demo_Course'
        xapi_transmissions = mock.MagicMock()
        xapi_transmissions.filter.return_value = [
            mock.MagicMock(user_id=12, course_id=course_id),
            mock.MagicMock(user_id=23, course_id=course_id)
        ]

        course_enrollments = []

        response = Command.get_pertinent_course_enrollments(
            course_enrollments,
            xapi_transmissions
        )
        assert len(response) == 0