Exemplo n.º 1
0
 def setUp(self):
     super().setUp()
     self.moodle_base_url = 'http://testing/'
     self.api_token = 'token'
     self.password = '******'
     self.user = '******'
     self.enterprise_config = factories.MoodleEnterpriseCustomerConfigurationFactory(
         moodle_base_url=self.moodle_base_url,
         username=self.user,
         password=self.password,
         token=self.api_token,
     )
Exemplo n.º 2
0
    def setUp(self):
        super().setUp()
        self.set_jwt_cookie(self.client, [(ENTERPRISE_ADMIN_ROLE, ENTERPRISE_ID)])
        self.client.force_authenticate(user=self.user)

        self.enterprise_customer = factories.EnterpriseCustomerFactory(uuid=ENTERPRISE_ID)
        self.enterprise_customer_user = factories.EnterpriseCustomerUserFactory(
            enterprise_customer=self.enterprise_customer,
            user_id=self.user.id,
        )

        self.moodle_config = factories.MoodleEnterpriseCustomerConfigurationFactory(
            enterprise_customer=self.enterprise_customer
        )
Exemplo n.º 3
0
    def setUp(self):
        with mock.patch('enterprise.signals.EnterpriseCatalogApiClient'):
            self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory(
            )

        # Need a non-abstract config.
        self.config = factories.MoodleEnterpriseCustomerConfigurationFactory(
            enterprise_customer=self.enterprise_customer_catalog.
            enterprise_customer, )

        # Mocks
        self.mock_enterprise_customer_catalogs(
            str(self.enterprise_customer_catalog.uuid))
        jwt_builder = mock.patch('enterprise.api_client.lms.JwtBuilder',
                                 mock.Mock())
        self.jwt_builder = jwt_builder.start()
        self.addCleanup(jwt_builder.stop)
        super().setUp()
Exemplo n.º 4
0
 def setUp(self):
     super().setUp()
     self.moodle_base_url = 'http://testing/'
     self.token = 'token'
     self.password = '******'
     self.user = '******'
     self.user_email = '*****@*****.**'
     self.moodle_api_path = '/webservice/rest/server.php'
     self.moodle_course_id = random.randint(1, 1000)
     self.moodle_module_id = random.randint(1, 1000)
     self.moodle_module_name = 'module'
     self.moodle_user_id = random.randint(1, 1000)
     self.grade = round(random.uniform(0, 1), 2)
     self.learner_data_payload = '{{"courseID": {}, "grade": {}}}'.format(self.moodle_course_id, self.grade)
     self.enterprise_config = factories.MoodleEnterpriseCustomerConfigurationFactory(
         moodle_base_url=self.moodle_base_url,
         username=self.user,
         password=self.password,
         token=self.token,
     )
    def setUp(self):
        super().setUp()
        self.enterprise_customer = factories.EnterpriseCustomerFactory()
        self.enterprise_customer_user = factories.EnterpriseCustomerUserFactory(
            enterprise_customer=self.enterprise_customer, )
        self.enterprise_course_enrollment = factories.EnterpriseCourseEnrollmentFactory(
            id=5,
            enterprise_customer_user=self.enterprise_customer_user,
        )
        self.enterprise_config = factories.MoodleEnterpriseCustomerConfigurationFactory(
            enterprise_customer=self.enterprise_customer,
            moodle_base_url='foobar',
            service_short_name='shortname',
            category_id=1,
            username='******',
            password='******',
            token='token',
        )
        self.payload = MoodleLearnerDataTransmissionAudit(
            moodle_user_email=self.enterprise_customer.contact_email,
            enterprise_course_enrollment_id=self.enterprise_course_enrollment.
            id,
            course_id='course-v1:edX+DemoX+DemoCourse',
            course_completed=True,
            completed_timestamp=1486855998,
            total_hours=1.0,
            grade=.9,
        )
        self.exporter = lambda payloads=self.payload: mock.MagicMock(
            export=mock.MagicMock(return_value=iter(payloads)))
        # Mocks
        create_course_completion_mock = mock.patch(
            'integrated_channels.moodle.client.MoodleAPIClient.create_course_completion'
        )
        self.create_course_completion_mock = create_course_completion_mock.start(
        )
        self.addCleanup(create_course_completion_mock.stop)

        self.create_course_completion_mock = create_course_completion_mock.start(
        )
        self.addCleanup(create_course_completion_mock.stop)