Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS * Generate common/djangoapps import shims for Studio * Stop appending project root to sys.path * Stop appending common/djangoapps to sys.path * Import from common.djangoapps.course_action_state instead of course_action_state * Import from common.djangoapps.course_modes instead of course_modes * Import from common.djangoapps.database_fixups instead of database_fixups * Import from common.djangoapps.edxmako instead of edxmako * Import from common.djangoapps.entitlements instead of entitlements * Import from common.djangoapps.pipline_mako instead of pipeline_mako * Import from common.djangoapps.static_replace instead of static_replace * Import from common.djangoapps.student instead of student * Import from common.djangoapps.terrain instead of terrain * Import from common.djangoapps.third_party_auth instead of third_party_auth * Import from common.djangoapps.track instead of track * Import from common.djangoapps.util instead of util * Import from common.djangoapps.xblock_django instead of xblock_django * Add empty common/djangoapps/__init__.py to fix pytest collection * Fix pylint formatting violations * Exclude import_shims/ directory tree from linting
This commit is contained in:
@@ -15,16 +15,16 @@ from django.utils.translation import override as override_language
|
||||
from django.utils.translation import ugettext as _
|
||||
from pytz import UTC
|
||||
from six import text_type # pylint: disable=ungrouped-imports
|
||||
from student import views as student_views
|
||||
from student.models import (
|
||||
from common.djangoapps.student import views as student_views
|
||||
from common.djangoapps.student.models import (
|
||||
AccountRecovery,
|
||||
User,
|
||||
UserProfile,
|
||||
email_exists_or_retired,
|
||||
username_exists_or_retired
|
||||
)
|
||||
from util.model_utils import emit_setting_changed_event
|
||||
from util.password_policy_validators import validate_password
|
||||
from common.djangoapps.util.model_utils import emit_setting_changed_event
|
||||
from common.djangoapps.util.password_policy_validators import validate_password
|
||||
|
||||
from openedx.core.djangoapps.user_api import accounts, errors, helpers
|
||||
from openedx.core.djangoapps.user_api.errors import (
|
||||
|
||||
@@ -11,7 +11,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.files.storage import get_storage_class
|
||||
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from student.models import UserProfile
|
||||
from common.djangoapps.student.models import UserProfile
|
||||
|
||||
from ..errors import UserNotFound
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ from django.urls import reverse
|
||||
from rest_framework import serializers
|
||||
from six import text_type
|
||||
|
||||
from student.models import UserPasswordToggleHistory
|
||||
from common.djangoapps.student.models import UserPasswordToggleHistory
|
||||
from lms.djangoapps.badges.utils import badges_enabled
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api import errors
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled
|
||||
from openedx.core.djangoapps.user_api.models import RetirementState, UserPreference, UserRetirementStatus
|
||||
from openedx.core.djangoapps.user_api.serializers import ReadOnlyFieldsSerializerMixin
|
||||
from student.models import LanguageProficiency, SocialLink, UserProfile
|
||||
from common.djangoapps.student.models import LanguageProficiency, SocialLink, UserProfile
|
||||
|
||||
from . import (
|
||||
ACCOUNT_VISIBILITY_PREF_KEY,
|
||||
|
||||
@@ -14,8 +14,8 @@ from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django_countries import countries
|
||||
|
||||
import third_party_auth
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from common.djangoapps import third_party_auth
|
||||
from common.djangoapps.edxmako.shortcuts import render_to_response
|
||||
from lms.djangoapps.commerce.models import CommerceConfiguration
|
||||
from lms.djangoapps.commerce.utils import EcommerceService
|
||||
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
|
||||
@@ -32,9 +32,9 @@ from openedx.core.lib.edx_api_utils import get_edx_api_data
|
||||
from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES
|
||||
from openedx.features.enterprise_support.api import enterprise_customer_for_request
|
||||
from openedx.features.enterprise_support.utils import update_account_settings_context_for_enterprise
|
||||
from student.models import UserProfile
|
||||
from third_party_auth import pipeline
|
||||
from util.date_utils import strftime_localized
|
||||
from common.djangoapps.student.models import UserProfile
|
||||
from common.djangoapps.third_party_auth import pipeline
|
||||
from common.djangoapps.util.date_utils import strftime_localized
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ from social_django.models import UserSocialAuth
|
||||
|
||||
from openedx.core.djangoapps.enrollments import api
|
||||
from openedx.core.djangoapps.user_api.models import RetirementState, UserRetirementStatus
|
||||
from student.models import get_retired_email_by_email, get_retired_username_by_username
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import get_retired_email_by_email, get_retired_username_by_username
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
from ..views import AccountRetirementView
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@ from django.urls import reverse
|
||||
from mock import Mock, patch
|
||||
from six import iteritems
|
||||
from social_django.models import UserSocialAuth
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
AccountRecovery,
|
||||
PendingEmailChange,
|
||||
PendingSecondaryEmailChange,
|
||||
UserProfile
|
||||
)
|
||||
from student.tests.factories import UserFactory
|
||||
from student.tests.tests import UserSettingsEventTestMixin
|
||||
from student.views.management import activate_secondary_email
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.tests import UserSettingsEventTestMixin
|
||||
from common.djangoapps.student.views.management import activate_secondary_email
|
||||
|
||||
from openedx.core.djangoapps.ace_common.tests.mixins import EmailTemplateTagMixin
|
||||
from openedx.core.djangoapps.user_api.accounts import PRIVATE_VISIBILITY
|
||||
@@ -80,7 +80,7 @@ class CreateAccountMixin(object):
|
||||
|
||||
@skip_unless_lms
|
||||
@ddt.ddt
|
||||
@patch('student.views.management.render_to_response', Mock(side_effect=mock_render_to_response, autospec=True))
|
||||
@patch('common.djangoapps.student.views.management.render_to_response', Mock(side_effect=mock_render_to_response, autospec=True))
|
||||
class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAccountMixin, RetirementTestCase):
|
||||
"""
|
||||
These tests specifically cover the parts of the API methods that are not covered by test_views.py.
|
||||
@@ -366,7 +366,7 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAc
|
||||
self.assertIn("Full Name cannot contain the following characters: < >", field_errors["name"]["user_message"])
|
||||
|
||||
@patch('django.core.mail.EmailMultiAlternatives.send')
|
||||
@patch('student.views.management.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True))
|
||||
@patch('common.djangoapps.student.views.management.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True))
|
||||
def test_update_sending_email_fails(self, send_mail):
|
||||
"""Test what happens if all validation checks pass, but sending the email for email change fails."""
|
||||
send_mail.side_effect = [Exception, None]
|
||||
|
||||
@@ -11,7 +11,7 @@ from mock import patch
|
||||
from pytz import UTC
|
||||
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from six import text_type
|
||||
|
||||
from ..image_helpers import get_profile_image_urls_for_user
|
||||
|
||||
@@ -11,8 +11,8 @@ from openedx.core.djangoapps.user_api.models import (
|
||||
UserRetirementRequest,
|
||||
UserRetirementStatus
|
||||
)
|
||||
from student.models import get_retired_email_by_email, get_retired_username_by_username
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import get_retired_email_by_email, get_retired_username_by_username
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
from .retirement_helpers import setup_retirement_states # pylint: disable=unused-import
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Tests for User deactivation API permissions
|
||||
from django.test import RequestFactory, TestCase
|
||||
|
||||
from openedx.core.djangoapps.user_api.accounts.permissions import CanDeactivateUser, CanRetireUser
|
||||
from student.tests.factories import ContentTypeFactory, PermissionFactory, SuperuserFactory, UserFactory
|
||||
from common.djangoapps.student.tests.factories import ContentTypeFactory, PermissionFactory, SuperuserFactory, UserFactory
|
||||
|
||||
|
||||
class CanDeactivateUserTest(TestCase):
|
||||
|
||||
@@ -35,8 +35,8 @@ from social_django.models import UserSocialAuth
|
||||
from wiki.models import Article, ArticleRevision
|
||||
from wiki.models.pluginbase import RevisionPlugin, RevisionPluginRevision
|
||||
|
||||
from entitlements.models import CourseEntitlementSupportDetail
|
||||
from entitlements.tests.factories import CourseEntitlementFactory
|
||||
from common.djangoapps.entitlements.models import CourseEntitlementSupportDetail
|
||||
from common.djangoapps.entitlements.tests.factories import CourseEntitlementFactory
|
||||
from openedx.core.djangoapps.api_admin.models import ApiAccessRequest
|
||||
from openedx.core.djangoapps.course_groups.models import CourseUserGroup, UnregisteredLearnerCohortAssignments
|
||||
from openedx.core.djangoapps.credit.models import (
|
||||
@@ -56,7 +56,7 @@ from openedx.core.djangoapps.user_api.models import (
|
||||
UserRetirementPartnerReportingStatus,
|
||||
UserRetirementStatus
|
||||
)
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
AccountRecovery,
|
||||
CourseEnrollment,
|
||||
CourseEnrollmentAllowed,
|
||||
@@ -69,7 +69,7 @@ from student.models import (
|
||||
get_retired_email_by_email,
|
||||
get_retired_username_by_username
|
||||
)
|
||||
from student.tests.factories import (
|
||||
from common.djangoapps.student.tests.factories import (
|
||||
AccountRecoveryFactory,
|
||||
ContentTypeFactory,
|
||||
CourseEnrollmentAllowedFactory,
|
||||
|
||||
@@ -10,8 +10,8 @@ from django.test.client import RequestFactory
|
||||
from testfixtures import LogCapture
|
||||
|
||||
from openedx.core.djangoapps.user_api.accounts.serializers import UserReadOnlySerializer
|
||||
from student.models import UserProfile
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import UserProfile
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
LOGGER_NAME = "openedx.core.djangoapps.user_api.accounts.serializers"
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ from openedx.core.djangoapps.user_api.accounts.toggles import REDIRECT_TO_ACCOUN
|
||||
from openedx.core.djangoapps.user_api.tests.factories import UserPreferenceFactory
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from openedx.features.enterprise_support.utils import get_enterprise_readonly_account_fields
|
||||
from student.tests.factories import UserFactory
|
||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
|
||||
@@ -9,8 +9,8 @@ from django.test.utils import override_settings
|
||||
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ from openedx.core.djangoapps.user_api.accounts import ACCOUNT_VISIBILITY_PREF_KE
|
||||
from openedx.core.djangoapps.user_api.models import UserPreference
|
||||
from openedx.core.djangoapps.user_api.preferences.api import set_user_preference
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from student.models import PendingEmailChange, UserProfile
|
||||
from student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
from common.djangoapps.student.models import PendingEmailChange, UserProfile
|
||||
from common.djangoapps.student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
|
||||
from .. import ALL_USERS_VISIBILITY, CUSTOM_VISIBILITY, PRIVATE_VISIBILITY
|
||||
|
||||
@@ -792,7 +792,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
|
||||
)
|
||||
self.assertEqual("Valid e-mail address required.", field_errors["email"]["user_message"])
|
||||
|
||||
@mock.patch('student.views.management.do_email_change_request')
|
||||
@mock.patch('common.djangoapps.student.views.management.do_email_change_request')
|
||||
def test_patch_duplicate_email(self, do_email_change_request):
|
||||
"""
|
||||
Test that same success response will be sent to user even if the given email already used.
|
||||
@@ -950,7 +950,7 @@ class TestAccountAPITransactions(TransactionTestCase):
|
||||
self.user = UserFactory.create(password=TEST_PASSWORD)
|
||||
self.url = reverse("accounts_api", kwargs={'username': self.user.username})
|
||||
|
||||
@mock.patch('student.views.do_email_change_request')
|
||||
@mock.patch('common.djangoapps.student.views.do_email_change_request')
|
||||
def test_update_account_settings_rollback(self, mock_email_change):
|
||||
"""
|
||||
Verify that updating account settings is transactional when a failure happens.
|
||||
|
||||
@@ -5,7 +5,7 @@ Utility functions, constants, etc. for testing.
|
||||
|
||||
|
||||
from openedx.core.djangoapps.user_api.accounts import EMAIL_MAX_LENGTH, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH
|
||||
from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
from common.djangoapps.util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
|
||||
INVALID_NAMES = [
|
||||
None,
|
||||
|
||||
@@ -39,7 +39,7 @@ from social_django.models import UserSocialAuth
|
||||
from wiki.models import ArticleRevision
|
||||
from wiki.models.pluginbase import RevisionPluginRevision
|
||||
|
||||
from entitlements.models import CourseEntitlement
|
||||
from common.djangoapps.entitlements.models import CourseEntitlement
|
||||
from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
|
||||
from openedx.core.djangoapps.api_admin.models import ApiAccessRequest
|
||||
from openedx.core.djangoapps.course_groups.models import UnregisteredLearnerCohortAssignments
|
||||
@@ -52,7 +52,7 @@ from openedx.core.djangoapps.user_authn.exceptions import AuthFailedError
|
||||
from openedx.core.djangolib.oauth2_retirement_utils import retire_dot_oauth2_models
|
||||
from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser
|
||||
from openedx.core.lib.api.parsers import MergePatchParser
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
AccountRecovery,
|
||||
CourseEnrollment,
|
||||
CourseEnrollmentAllowed,
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.test import TestCase
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
|
||||
from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
|
||||
class TestCourseTagAPI(TestCase):
|
||||
|
||||
@@ -22,12 +22,12 @@ from integrated_channels.sap_success_factors.models import SapSuccessFactorsLear
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from pytz import UTC
|
||||
|
||||
from entitlements.models import CourseEntitlement, CourseEntitlementSupportDetail
|
||||
from common.djangoapps.entitlements.models import CourseEntitlement, CourseEntitlementSupportDetail
|
||||
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
|
||||
from openedx.core.djangoapps.course_groups.models import CourseUserGroup, UnregisteredLearnerCohortAssignments
|
||||
from openedx.core.djangoapps.profile_images.images import create_profile_images
|
||||
from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file
|
||||
from student.models import CourseEnrollment, CourseEnrollmentAllowed, PendingEmailChange, UserProfile
|
||||
from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed, PendingEmailChange, UserProfile
|
||||
|
||||
from ...models import UserOrgTag
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import transaction
|
||||
from social_django.models import UserSocialAuth
|
||||
|
||||
from student.models import AccountRecovery, Registration, get_retired_email_by_email
|
||||
from common.djangoapps.student.models import AccountRecovery, Registration, get_retired_email_by_email
|
||||
from openedx.core.djangolib.oauth2_retirement_utils import retire_dot_oauth2_models
|
||||
|
||||
from ...models import UserRetirementStatus
|
||||
|
||||
@@ -18,8 +18,8 @@ from edx_rest_api_client.client import EdxRestApiClient
|
||||
from slumber.exceptions import HttpClientError, HttpServerError
|
||||
|
||||
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
|
||||
from student.models import UserAttribute
|
||||
from util.query import use_read_replica_if_available
|
||||
from common.djangoapps.student.models import UserAttribute
|
||||
from common.djangoapps.util.query import use_read_replica_if_available
|
||||
|
||||
HUBSPOT_API_BASE_URL = 'https://api.hubapi.com'
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import (
|
||||
setup_retirement_states
|
||||
)
|
||||
from openedx.core.djangoapps.user_api.models import RetirementState, UserRetirementRequest, UserRetirementStatus
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ from openedx.core.djangoapps.user_api.management.commands import email_opt_in_li
|
||||
from openedx.core.djangoapps.user_api.models import UserOrgTag
|
||||
from openedx.core.djangoapps.user_api.preferences.api import update_email_opt_in
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.core.management import CommandError, call_command
|
||||
|
||||
from openedx.core.djangoapps.user_api.management.commands.populate_retirement_states import START_STATE
|
||||
from openedx.core.djangoapps.user_api.models import RetirementState, UserRetirementStatus
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import (
|
||||
setup_retirement_states
|
||||
)
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
@@ -16,8 +16,8 @@ from six.moves import range
|
||||
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory
|
||||
from openedx.core.djangoapps.user_api.management.commands.sync_hubspot_contacts import Command as sync_command
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.models import UserAttribute, UserProfile
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import UserAttribute, UserProfile
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
|
||||
@@ -9,7 +9,7 @@ from eventtracking import tracker
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from track.contexts import COURSE_REGEX
|
||||
from common.djangoapps.track.contexts import COURSE_REGEX
|
||||
|
||||
from .models import UserCourseTag
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ from opaque_keys.edx.django.models import CourseKeyField
|
||||
from openedx.core.djangolib.model_mixins import DeletableByUserValue
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
# pylint: disable=unused-import
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
PendingEmailChange,
|
||||
Registration,
|
||||
UserProfile,
|
||||
get_retired_email_by_email,
|
||||
get_retired_username_by_username
|
||||
)
|
||||
from util.model_utils import emit_setting_changed_event, get_changed_fields_dict
|
||||
from common.djangoapps.util.model_utils import emit_setting_changed_event, get_changed_fields_dict
|
||||
|
||||
|
||||
class RetirementStateError(Exception):
|
||||
|
||||
@@ -15,8 +15,8 @@ from django_countries import countries
|
||||
from pytz import common_timezones, common_timezones_set, country_timezones
|
||||
|
||||
from openedx.core.lib.time_zone_utils import get_display_time_zone
|
||||
from student.models import User, UserProfile
|
||||
from track import segment
|
||||
from common.djangoapps.student.models import User, UserProfile
|
||||
from common.djangoapps.track import segment
|
||||
|
||||
from ..errors import (
|
||||
CountryCodeError,
|
||||
|
||||
@@ -16,8 +16,8 @@ from pytz import common_timezones, utc
|
||||
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from openedx.core.lib.time_zone_utils import get_display_time_zone
|
||||
from student.models import UserProfile
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.models import UserProfile
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from mock import patch
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
from common.djangoapps.student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
|
||||
from ...accounts.tests.test_views import UserAPITestCase
|
||||
from ..api import set_user_preference
|
||||
|
||||
@@ -5,7 +5,7 @@ from factory import SubFactory
|
||||
from factory.django import DjangoModelFactory
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
from ..models import UserCourseTag, UserOrgTag, UserPreference
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
from mock import Mock, patch
|
||||
|
||||
from student.tests.factories import AnonymousUserFactory, UserFactory
|
||||
from common.djangoapps.student.tests.factories import AnonymousUserFactory, UserFactory
|
||||
|
||||
from ..middleware import UserTagsEventContextMiddleware
|
||||
from ..tests.factories import UserCourseTagFactory
|
||||
|
||||
@@ -6,8 +6,8 @@ Test UserPreferenceModel and UserPreference events
|
||||
from django.db import IntegrityError
|
||||
from django.test import TestCase
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
from student.tests.tests import UserSettingsEventTestMixin
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.tests import UserSettingsEventTestMixin
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from mock import patch
|
||||
from six.moves import range
|
||||
|
||||
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme, UserPartitionError
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.partitions.partitions import Group, UserPartition
|
||||
from xmodule.partitions.tests.test_partitions import PartitionTestCase
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ from openedx.core.djangoapps.site_configuration.tests.test_util import with_site
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from openedx.core.lib.api.test_utils import TEST_API_KEY, ApiTestCase
|
||||
from openedx.core.lib.time_zone_utils import get_display_time_zone
|
||||
from student.tests.factories import UserFactory
|
||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
from third_party_auth.tests.utils import (
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
from common.djangoapps.third_party_auth.tests.utils import (
|
||||
ThirdPartyOAuthTestMixin,
|
||||
ThirdPartyOAuthTestMixinFacebook,
|
||||
ThirdPartyOAuthTestMixinGoogle
|
||||
)
|
||||
from util.password_policy_validators import (
|
||||
from common.djangoapps.util.password_policy_validators import (
|
||||
create_validator_config,
|
||||
password_validators_instruction_texts,
|
||||
password_validators_restrictions
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.urls import reverse
|
||||
|
||||
from lms.djangoapps.verify_student.models import ManualVerification, SoftwareSecurePhotoVerification, SSOVerification
|
||||
from lms.djangoapps.verify_student.tests.factories import SSOVerificationFactory
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
FROZEN_TIME = '2015-01-01'
|
||||
VERIFY_STUDENT = {'DAYS_GOOD_FOR': 365}
|
||||
|
||||
@@ -30,8 +30,8 @@ from openedx.core.djangoapps.user_api.serializers import (
|
||||
UserSerializer
|
||||
)
|
||||
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
|
||||
from student.helpers import AccountValidationError
|
||||
from util.json_request import JsonResponse
|
||||
from common.djangoapps.student.helpers import AccountValidationError
|
||||
from common.djangoapps.util.json_request import JsonResponse
|
||||
|
||||
|
||||
class UserViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
||||
Reference in New Issue
Block a user