Skip to content

Commit

Permalink
Merge pull request #1939 from openedx/asaeed/ENT-4955
Browse files Browse the repository at this point in the history
[ENT-4955] chore: remove Degreed v1 from the set of channels
  • Loading branch information
justEhmadSaeed authored Nov 13, 2023
2 parents 40e01dc + 22d94b1 commit df00d4a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
Nothing unreleased.

[4.7.1]
--------
chore: retire Degreed v1 code from the set of channels

[4.7.0]
--------
feat: Add an ``api-docs`` page that lives at ``[LMS_ROOT_URL]/enterprise/api-docs/``
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.7.0"
__version__ = "4.7.1"
3 changes: 0 additions & 3 deletions integrated_channels/degreed/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from integrated_channels.integrated_channel.admin import BaseLearnerDataTransmissionAuditAdmin


@admin.register(DegreedGlobalConfiguration)
class DegreedGlobalConfigurationAdmin(ConfigurationModelAdmin):
"""
Django admin model for DegreedGlobalConfiguration.
Expand All @@ -33,7 +32,6 @@ class Meta:
model = DegreedGlobalConfiguration


@admin.register(DegreedEnterpriseCustomerConfiguration)
class DegreedEnterpriseCustomerConfigurationAdmin(DjangoObjectActions, admin.ModelAdmin):
"""
Django admin model for DegreedEnterpriseCustomerConfiguration.
Expand Down Expand Up @@ -106,7 +104,6 @@ def force_content_metadata_transmission(self, request, obj):
force_content_metadata_transmission.label = "Force content metadata transmission"


@admin.register(DegreedLearnerDataTransmissionAudit)
class DegreedLearnerDataTransmissionAuditAdmin(BaseLearnerDataTransmissionAuditAdmin):
"""
Django admin model for DegreedLearnerDataTransmissionAudit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
BlackboardEnterpriseCustomerConfiguration,
CanvasEnterpriseCustomerConfiguration,
CornerstoneEnterpriseCustomerConfiguration,
DegreedEnterpriseCustomerConfiguration,
Degreed2EnterpriseCustomerConfiguration,
MoodleEnterpriseCustomerConfiguration,
SAPSuccessFactorsEnterpriseCustomerConfiguration,
Expand All @@ -44,7 +43,6 @@
BlackboardEnterpriseCustomerConfiguration,
CanvasEnterpriseCustomerConfiguration,
CornerstoneEnterpriseCustomerConfiguration,
DegreedEnterpriseCustomerConfiguration,
Degreed2EnterpriseCustomerConfiguration,
MoodleEnterpriseCustomerConfiguration,
SAPSuccessFactorsEnterpriseCustomerConfiguration,
Expand Down
43 changes: 19 additions & 24 deletions tests/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
CornerstoneEnterpriseCustomerConfiguration,
CornerstoneLearnerDataTransmissionAudit,
)
from integrated_channels.degreed.models import DegreedEnterpriseCustomerConfiguration
from integrated_channels.degreed2.models import Degreed2EnterpriseCustomerConfiguration
from integrated_channels.integrated_channel.exporters.learner_data import LearnerExporter
from integrated_channels.integrated_channel.management.commands import (
ASSESSMENT_LEVEL_REPORTING_INTEGRATED_CHANNEL_CHOICES,
Expand Down Expand Up @@ -87,7 +87,7 @@ class TestIntegratedChannelCommandMixin(unittest.TestCase):
Tests for the ``IntegratedChannelCommandMixin`` class.
"""

@ddt.data('SAP', 'DEGREED')
@ddt.data('SAP', 'DEGREED2')
def test_transmit_content_metadata_specific_channel(self, channel_code):
"""
Only the channel we input is what we get out.
Expand Down Expand Up @@ -143,12 +143,9 @@ def setUp(self):
self.enterprise_customer = factories.EnterpriseCustomerFactory(
name='Veridian Dynamics',
)
self.degreed = factories.DegreedEnterpriseCustomerConfigurationFactory(
self.degreed2 = factories.Degreed2EnterpriseCustomerConfigurationFactory(
enterprise_customer=self.enterprise_customer,
key='key',
secret='secret',
degreed_company_id='Degreed Company',
degreed_base_url='https://www.degreed.com/',
degreed_base_url='http://betatest.degreed.com/',
)
self.sapsf = factories.SAPSuccessFactorsEnterpriseCustomerConfigurationFactory(
enterprise_customer=self.enterprise_customer,
Expand Down Expand Up @@ -193,7 +190,7 @@ def test_override_user(self):

@responses.activate
@freeze_time(NOW)
@mock.patch('integrated_channels.degreed.client.DegreedAPIClient.create_content_metadata')
@mock.patch('integrated_channels.degreed2.client.Degreed2APIClient.create_content_metadata')
@mock.patch('integrated_channels.sap_success_factors.client.SAPSuccessFactorsAPIClient.get_oauth_access_token')
@mock.patch('integrated_channels.sap_success_factors.client.SAPSuccessFactorsAPIClient.update_content_metadata')
@mock.patch('integrated_channels.integrated_channel.management.commands.transmit_content_metadata.transmit_content_metadata.delay')
Expand All @@ -202,7 +199,7 @@ def test_transmit_content_metadata_task_with_error(
transmit_content_metadata_mock,
sapsf_update_content_metadata_mock,
sapsf_get_oauth_access_token_mock,
degreed_create_content_metadata_mock,
degreed2_create_content_metadata_mock,
):
"""
Verify the data transmission task for integrated channels with error.
Expand All @@ -213,7 +210,7 @@ def test_transmit_content_metadata_task_with_error(
"""
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, '{}'
degreed2_create_content_metadata_mock.return_value = 200, '{}'

content_filter = {
'key': ['course-v1:edX+DemoX+Demo_Course_1']
Expand All @@ -237,12 +234,9 @@ def test_transmit_content_metadata_task_with_error(
content_filter=content_filter
)
self.mock_enterprise_customer_catalogs(str(enterprise_catalog.uuid))
dummy_degreed = factories.DegreedEnterpriseCustomerConfigurationFactory(
dummy_degreed2 = factories.Degreed2EnterpriseCustomerConfigurationFactory(
enterprise_customer=dummy_enterprise_customer,
key='key',
secret='secret',
degreed_company_id='Degreed Company',
degreed_base_url='https://www.degreed.com/',
degreed_base_url='http://betatest.degreed.com/',
active=True,
)
dummy_sapsf = factories.SAPSuccessFactorsEnterpriseCustomerConfigurationFactory(
Expand All @@ -255,7 +249,7 @@ def test_transmit_content_metadata_task_with_error(

expected_calls = [
mock.call(username='C-3PO', channel_code='SAP', channel_pk=1),
mock.call(username='C-3PO', channel_code='DEGREED', channel_pk=1)
mock.call(username='C-3PO', channel_code='DEGREED2', channel_pk=1),
]

call_command('transmit_content_metadata', '--catalog_user', 'C-3PO')
Expand All @@ -264,7 +258,7 @@ def test_transmit_content_metadata_task_with_error(

@responses.activate
@freeze_time(NOW)
@mock.patch('integrated_channels.degreed.client.DegreedAPIClient.create_content_metadata')
@mock.patch('integrated_channels.degreed2.client.Degreed2APIClient.create_content_metadata')
@mock.patch('integrated_channels.sap_success_factors.client.SAPSuccessFactorsAPIClient.get_oauth_access_token')
@mock.patch('integrated_channels.sap_success_factors.client.SAPSuccessFactorsAPIClient.update_content_metadata')
@mock.patch('integrated_channels.integrated_channel.management.commands.transmit_content_metadata.transmit_content_metadata.delay')
Expand All @@ -273,22 +267,22 @@ def test_transmit_content_metadata_task_success(
transmit_content_metadata_mock,
sapsf_update_content_metadata_mock,
sapsf_get_oauth_access_token_mock,
degreed_create_content_metadata_mock,
degreed2_create_content_metadata_mock,
):
"""
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, '{}'
degreed2_create_content_metadata_mock.return_value = 200, '{}'

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_calls = [
mock.call(username='C-3PO', channel_code='SAP', channel_pk=1),
mock.call(username='C-3PO', channel_code='DEGREED', channel_pk=1),
mock.call(username='C-3PO', channel_code='DEGREED2', channel_pk=1),
]

call_command('transmit_content_metadata', '--catalog_user', 'C-3PO')
Expand All @@ -307,7 +301,7 @@ def test_transmit_content_metadata_task_no_channel(self):

# Remove all integrated channels
SAPSuccessFactorsEnterpriseCustomerConfiguration.objects.all().delete()
DegreedEnterpriseCustomerConfiguration.objects.all().delete()
Degreed2EnterpriseCustomerConfiguration.objects.all().delete()

with LogCapture(level=logging.INFO) as log_capture:
call_command('transmit_content_metadata', '--catalog_user', user.username)
Expand Down Expand Up @@ -1907,12 +1901,12 @@ def setUp(self):
)
self.enterprise_customer.enterprise_customer_catalogs.set([enterprise_catalog])
self.enterprise_customer.save()
self.customer_config = factories.DegreedEnterpriseCustomerConfigurationFactory(
self.customer_config = factories.SAPSuccessFactorsEnterpriseCustomerConfigurationFactory(
enterprise_customer=self.enterprise_customer,
sapsf_base_url='http://enterprise.successfactors.com/',
key='key',
secret='secret',
degreed_company_id='Degreed Company',
degreed_base_url='https://www.degreed.com/',
active=True,
)
self.orphaned_content = factories.ContentMetadataItemTransmissionFactory(
content_id='DemoX',
Expand Down Expand Up @@ -2020,6 +2014,7 @@ class TestRemoveNullCatalogTransmissionAuditsManagementCommand(unittest.TestCase
"""
Test the ``remove_null_catalog_transmission_audits`` management command.
"""

def setUp(self):
self.enterprise_customer_1 = factories.EnterpriseCustomerFactory(
name='Wonka Factory',
Expand Down

0 comments on commit df00d4a

Please sign in to comment.