Skip to content

Commit f572079

Browse files
Sameen FatimaSameen Fatima
authored andcommitted
fix: point to new models in channel_migrations app
1 parent e8bfb13 commit f572079

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from consent.models import DataSharingConsent
1212
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
1313
from django.contrib.sites.models import Site
14+
from django.conf import settings
1415
from django.core import mail
1516
from django.core.cache import cache
1617
from django.test import TestCase
@@ -21,7 +22,11 @@
2122
EnterpriseCustomerUser,
2223
PendingEnterpriseCustomerUser
2324
)
24-
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
25+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
26+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
27+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
28+
else:
29+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
2530
from opaque_keys.edx.keys import CourseKey
2631
from rest_framework import status
2732
from social_django.models import UserSocialAuth

openedx/core/djangoapps/user_api/accounts/views.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
2727
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
2828
from enterprise.models import EnterpriseCourseEnrollment, EnterpriseCustomerUser, PendingEnterpriseCustomerUser
29-
from integrated_channels.degreed.models import DegreedLearnerDataTransmissionAudit
30-
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
29+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
30+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
31+
from integrated_channels.degreed.models import DegreedLearnerDataTransmissionAudit
32+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
33+
else:
34+
from channel_integrations.degreed2.models import Degreed2LearnerDataTransmissionAudit as DegreedLearnerDataTransmissionAudit
35+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
3136
from rest_framework import permissions, status
3237
from rest_framework.authentication import SessionAuthentication
3338
from rest_framework.exceptions import UnsupportedMediaType

openedx/core/djangoapps/user_api/management/commands/create_user_gdpr_testing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111

1212
from consent.models import DataSharingConsent
1313
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
14+
from django.conf import settings
1415
from django.core.management.base import BaseCommand
1516
from enterprise.models import (
1617
EnterpriseCourseEnrollment,
1718
EnterpriseCustomer,
1819
EnterpriseCustomerUser,
1920
PendingEnterpriseCustomerUser
2021
)
21-
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
22+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
23+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
24+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
25+
else:
26+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
2227
from opaque_keys.edx.keys import CourseKey
2328
from zoneinfo import ZoneInfo
2429

openedx/features/enterprise_support/signals.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
from django.db.models.signals import post_save, pre_save
1111
from django.dispatch import receiver
1212
from enterprise.models import EnterpriseCourseEnrollment, EnterpriseCustomer
13-
from integrated_channels.integrated_channel.tasks import (
14-
transmit_single_learner_data,
15-
transmit_single_subsection_learner_data
16-
)
13+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
14+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
15+
from integrated_channels.integrated_channel.tasks import (
16+
transmit_single_learner_data,
17+
transmit_single_subsection_learner_data
18+
)
19+
else:
20+
from channel_integrations.integrated_channel.tasks import (
21+
transmit_single_learner_data,
22+
transmit_single_subsection_learner_data
23+
)
1724
from slumber.exceptions import HttpClientError
1825

1926
from common.djangoapps.student.signals import UNENROLL_DONE

openedx/features/enterprise_support/tests/test_signals.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unittest.mock import patch
77

88
import ddt
9+
from django.conf import settings
910
from django.test.utils import override_settings
1011
from django.utils.timezone import now
1112
from edx_django_utils.cache import TieredCache
@@ -196,7 +197,9 @@ def test_handle_enterprise_learner_passing_grade(self):
196197
Test to assert transmit_single_learner_data is called when COURSE_GRADE_NOW_PASSED signal is fired
197198
"""
198199
with patch(
199-
'integrated_channels.integrated_channel.tasks.transmit_single_learner_data.apply_async',
200+
'integrated_channels.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async'
201+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True) else
202+
'channel_integrations.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async',
200203
return_value=None
201204
) as mock_task_apply:
202205
course_key = CourseKey.from_string(self.course_id)
@@ -218,7 +221,9 @@ def test_handle_enterprise_learner_subsection(self):
218221
Test to assert transmit_subsection_learner_data is called when COURSE_ASSESSMENT_GRADE_CHANGED signal is fired.
219222
"""
220223
with patch(
221-
'integrated_channels.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async',
224+
'integrated_channels.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async'
225+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True) else
226+
'channel_integrations.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async',
222227
return_value=None
223228
) as mock_task_apply:
224229
course_key = CourseKey.from_string(self.course_id)

0 commit comments

Comments
 (0)