Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from consent.models import DataSharingConsent
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.contrib.sites.models import Site
from django.conf import settings
from django.core import mail
from django.core.cache import cache
from django.test import TestCase
Expand All @@ -21,7 +22,6 @@
EnterpriseCustomerUser,
PendingEnterpriseCustomerUser
)
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
from opaque_keys.edx.keys import CourseKey
from rest_framework import status
from social_django.models import UserSocialAuth
Expand Down Expand Up @@ -87,6 +87,12 @@
setup_retirement_states
)

# This is a temporary import path while we transition from integrated_channels to channel_integrations
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
else:
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit


def build_jwt_headers(user):
"""
Expand Down
11 changes: 9 additions & 2 deletions openedx/core/djangoapps/user_api/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from enterprise.models import EnterpriseCourseEnrollment, EnterpriseCustomerUser, PendingEnterpriseCustomerUser
from integrated_channels.degreed.models import DegreedLearnerDataTransmissionAudit
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
from rest_framework import permissions, status
from rest_framework.authentication import SessionAuthentication
from rest_framework.exceptions import UnsupportedMediaType
Expand Down Expand Up @@ -97,6 +95,15 @@
from .signals import USER_RETIRE_LMS_CRITICAL, USER_RETIRE_LMS_MISC, USER_RETIRE_MAILINGS
from .utils import create_retirement_request_and_deactivate_account, username_suffix_generator

# This is a temporary import path while we transition from integrated_channels to channel_integrations
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
from integrated_channels.degreed.models import DegreedLearnerDataTransmissionAudit
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
else:
from channel_integrations.degreed2.models import Degreed2LearnerDataTransmissionAudit \
as DegreedLearnerDataTransmissionAudit
Comment on lines +103 to +104
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The backslash line continuation can be avoided by using parentheses, which is the preferred Python style. Consider wrapping the import statement in parentheses instead:\npython\nfrom channel_integrations.degreed2.models import (\n Degreed2LearnerDataTransmissionAudit as DegreedLearnerDataTransmissionAudit\n)\n

Suggested change
from channel_integrations.degreed2.models import Degreed2LearnerDataTransmissionAudit \
as DegreedLearnerDataTransmissionAudit
from channel_integrations.degreed2.models import (
Degreed2LearnerDataTransmissionAudit as DegreedLearnerDataTransmissionAudit
)

Copilot uses AI. Check for mistakes.
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit

log = logging.getLogger(__name__)

USER_PROFILE_PII = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

from consent.models import DataSharingConsent
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.conf import settings
from django.core.management.base import BaseCommand
from enterprise.models import (
EnterpriseCourseEnrollment,
EnterpriseCustomer,
EnterpriseCustomerUser,
PendingEnterpriseCustomerUser
)
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
from opaque_keys.edx.keys import CourseKey
from pytz import UTC

Expand All @@ -31,6 +31,12 @@

from ...models import UserOrgTag

# This is a temporary import path while we transition from integrated_channels to channel_integrations
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
from integrated_channels.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit
else:
from channel_integrations.sap_success_factors.models import SapSuccessFactorsLearnerDataTransmissionAudit


class Command(BaseCommand):
"""
Expand Down
16 changes: 12 additions & 4 deletions openedx/features/enterprise_support/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from enterprise.models import EnterpriseCourseEnrollment, EnterpriseCustomer
from integrated_channels.integrated_channel.tasks import (
transmit_single_learner_data,
transmit_single_subsection_learner_data
)
from slumber.exceptions import HttpClientError

from common.djangoapps.student.signals import UNENROLL_DONE
Expand All @@ -22,6 +18,18 @@
from openedx.features.enterprise_support.tasks import clear_enterprise_customer_data_consent_share_cache
from openedx.features.enterprise_support.utils import clear_data_consent_share_cache, is_enterprise_learner

# This is a temporary import path while we transition from integrated_channels to channel_integrations
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True):
from integrated_channels.integrated_channel.tasks import (
transmit_single_learner_data,
transmit_single_subsection_learner_data
)
else:
from channel_integrations.integrated_channel.tasks import (
transmit_single_learner_data,
transmit_single_subsection_learner_data
)

log = logging.getLogger(__name__)


Expand Down
9 changes: 7 additions & 2 deletions openedx/features/enterprise_support/tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from unittest.mock import patch

import ddt
from django.conf import settings
from django.test.utils import override_settings
from django.utils.timezone import now
from edx_django_utils.cache import TieredCache
Expand Down Expand Up @@ -196,7 +197,9 @@ def test_handle_enterprise_learner_passing_grade(self):
Test to assert transmit_single_learner_data is called when COURSE_GRADE_NOW_PASSED signal is fired
"""
with patch(
'integrated_channels.integrated_channel.tasks.transmit_single_learner_data.apply_async',
'integrated_channels.integrated_channel.tasks.transmit_single_learner_data.apply_async'
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True) else
'channel_integrations.integrated_channel.tasks.transmit_single_learner_data.apply_async',
return_value=None
) as mock_task_apply:
course_key = CourseKey.from_string(self.course_id)
Expand All @@ -218,7 +221,9 @@ def test_handle_enterprise_learner_subsection(self):
Test to assert transmit_subsection_learner_data is called when COURSE_ASSESSMENT_GRADE_CHANGED signal is fired.
"""
with patch(
'integrated_channels.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async',
'integrated_channels.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async'
if getattr(settings, 'ENABLE_LEGACY_INTEGRATED_CHANNELS', True) else
'channel_integrations.integrated_channel.tasks.transmit_single_subsection_learner_data.apply_async',
return_value=None
) as mock_task_apply:
course_key = CourseKey.from_string(self.course_id)
Expand Down
Loading