Skip to content

Commit 8e6e207

Browse files
Sameen FatimaSameen Fatima
authored andcommitted
fix: point to new models in channel_migrations app
fix: fixed tests and quality failures
1 parent 7121238 commit 8e6e207

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

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

Lines changed: 7 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,6 @@
2122
EnterpriseCustomerUser,
2223
PendingEnterpriseCustomerUser
2324
)
24-
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
2525
from opaque_keys.edx.keys import CourseKey
2626
from rest_framework import status
2727
from social_django.models import UserSocialAuth
@@ -87,6 +87,12 @@
8787
setup_retirement_states
8888
)
8989

90+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
91+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
92+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
93+
else:
94+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
95+
9096

9197
def build_jwt_headers(user):
9298
"""

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
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
3129
from rest_framework import permissions, status
3230
from rest_framework.authentication import SessionAuthentication
3331
from rest_framework.exceptions import UnsupportedMediaType
@@ -97,6 +95,15 @@
9795
from .signals import USER_RETIRE_LMS_CRITICAL, USER_RETIRE_LMS_MISC, USER_RETIRE_MAILINGS
9896
from .utils import create_retirement_request_and_deactivate_account, username_suffix_generator
9997

98+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
99+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
100+
from integrated_channels.degreed.models import DegreedLearnerDataTransmissionAudit
101+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
102+
else:
103+
from channel_integrations.degreed2.models import Degreed2LearnerDataTransmissionAudit \
104+
as DegreedLearnerDataTransmissionAudit
105+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
106+
100107
log = logging.getLogger(__name__)
101108

102109
USER_PROFILE_PII = {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
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
2222
from opaque_keys.edx.keys import CourseKey
2323
from zoneinfo import ZoneInfo
2424

@@ -31,6 +31,12 @@
3131

3232
from ...models import UserOrgTag
3333

34+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
35+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
36+
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
37+
else:
38+
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
39+
3440

3541
class Command(BaseCommand):
3642
"""

openedx/features/enterprise_support/signals.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
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-
)
1713
from slumber.exceptions import HttpClientError
1814

1915
from common.djangoapps.student.signals import UNENROLL_DONE
@@ -22,6 +18,18 @@
2218
from openedx.features.enterprise_support.tasks import clear_enterprise_customer_data_consent_share_cache
2319
from openedx.features.enterprise_support.utils import clear_data_consent_share_cache, is_enterprise_learner
2420

21+
# This is a temporary import path while we transition from integrated_channels to channel_integrations
22+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
23+
from integrated_channels.integrated_channel.tasks import (
24+
transmit_single_learner_data,
25+
transmit_single_subsection_learner_data
26+
)
27+
else:
28+
from channel_integrations.integrated_channel.tasks import (
29+
transmit_single_learner_data,
30+
transmit_single_subsection_learner_data
31+
)
32+
2533
log = logging.getLogger(__name__)
2634

2735

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_learner_data.apply_async'
201+
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True) else
202+
'channel_integrations.integrated_channel.tasks.transmit_single_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)