def setUp(self):
        self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory()

        # Need a non-abstract config.
        self.config = factories.DegreedEnterpriseCustomerConfigurationFactory(
            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()
Пример #2
0
    def setUp(self):
        with mock.patch('enterprise.signals.EnterpriseCatalogApiClient'):
            self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory()

        # Need a non-abstract config.
        self.config = factories.CanvasEnterpriseCustomerConfigurationFactory(
            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(TestCanvasContentMetadataExporter, self).setUp()
    def setUp(self):
        with mock.patch('enterprise.signals.EnterpriseCatalogApiClient'):
            self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory(
            )

        self.config = factories.BlackboardEnterpriseCustomerConfigurationFactory(
            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()
    def setUp(self):
        self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory()

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

        # Mocks
        self.mock_ent_courses_api_with_pagination(
            str(self.enterprise_customer_catalog.enterprise_customer.uuid),
            ['course-v1:edX+DemoX+Demo_Course']
        )
        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(TestDegreedContentMetadataExporter, self).setUp()
Пример #5
0
    def setUp(self):
        courses_list_endpoint = reverse('cornerstone-course-list')
        self.course_list_url = settings.TEST_SERVER + courses_list_endpoint
        self.enterprise_customer_catalog = factories.EnterpriseCustomerCatalogFactory(
        )

        # Need a non-abstract config.
        self.config = factories.CornerstoneEnterpriseCustomerConfigurationFactory(
            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(TestCornerstoneCoursesListView, self).setUp()
Пример #6
0
    def test_transmit_content_metadata_task_success(
        self,
        sapsf_update_content_metadata_mock,
        sapsf_get_oauth_access_token_mock,
        degreed_create_content_metadata_mock,
    ):  # pylint: disable=invalid-name
        """
        Test the data transmission task.
        """
        sapsf_get_oauth_access_token_mock.return_value = "token", datetime.utcnow(
        )
        sapsf_update_content_metadata_mock.return_value = 200, '{}'
        degreed_create_content_metadata_mock.return_value = 200, '{}'

        uuid = str(self.enterprise_customer.uuid)
        course_run_ids = [
            'course-v1:edX+DemoX+Demo_Course_1',
            'course-v1:edX+DemoX+Demo_Course_2'
        ]
        self.mock_ent_courses_api_with_pagination(
            enterprise_uuid=uuid, course_run_ids=course_run_ids[:1])

        factories.EnterpriseCustomerCatalogFactory(
            enterprise_customer=self.enterprise_customer)
        enterprise_catalog_uuid = str(
            self.enterprise_customer.enterprise_customer_catalogs.first().uuid)
        self.mock_enterprise_customer_catalogs(enterprise_catalog_uuid)

        expected_messages = [
            # SAPSF
            'Transmitting content metadata to integrated channel using configuration: '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Retrieved content metadata for enterprise [{}]'.format(
                self.enterprise_customer.name),
            'Exporting content metadata item with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit creation of [4] content metadata items with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit update of [0] content metadata items with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit deletion of [0] content metadata items with plugin configuration '
            '[<SAPSuccessFactorsEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Content metadata transmission task for integrated channel configuration [{}] took [0.0] seconds'
            .format(self.sapsf),

            # Degreed
            'Transmitting content metadata to integrated channel using configuration: '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Retrieved content metadata for enterprise [{}]'.format(
                self.enterprise_customer.name),
            'Exporting content metadata item with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Exporting content metadata item with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit creation of [4] content metadata items with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit update of [0] content metadata items with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Preparing to transmit deletion of [0] content metadata items with plugin configuration '
            '[<DegreedEnterpriseCustomerConfiguration for Enterprise Veridian Dynamics>]',
            'Content metadata transmission task for integrated channel configuration [{}] took [0.0] seconds'
            .format(self.degreed)
        ]

        with LogCapture(level=logging.INFO) as log_capture:
            call_command('transmit_content_metadata', '--catalog_user',
                         'C-3PO')
            for index, message in enumerate(expected_messages):
                assert message in log_capture.records[index].getMessage()