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:
@@ -9,8 +9,8 @@ from rest_framework.test import APITestCase
|
||||
from six.moves.urllib.parse import urlencode
|
||||
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from third_party_auth import pipeline
|
||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
from common.djangoapps.third_party_auth import pipeline
|
||||
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
|
||||
@@ -22,7 +22,6 @@ from openedx.core.djangoapps.oauth_dispatch.api import create_dot_access_token
|
||||
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_from_token
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed
|
||||
from openedx.core.djangoapps.user_authn.exceptions import AuthFailedError
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewi
|
||||
from openedx.core.djangoapps.user_authn import cookies as cookies_api
|
||||
from openedx.core.djangoapps.user_authn.tests.utils import setup_login_oauth_client
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import AnonymousUserFactory, UserFactory
|
||||
from common.djangoapps.student.tests.factories import AnonymousUserFactory, UserFactory
|
||||
|
||||
|
||||
class CookieTests(TestCase):
|
||||
|
||||
@@ -13,7 +13,7 @@ from rest_framework import status
|
||||
|
||||
from openedx.core.djangoapps.oauth_dispatch.adapters.dot import DOTAdapter
|
||||
from openedx.core.djangoapps.oauth_dispatch.jwt import _create_jwt
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
|
||||
class AuthType(Enum):
|
||||
|
||||
@@ -13,9 +13,9 @@ from django.utils.translation import ugettext as _
|
||||
from oauth2_provider.models import Application
|
||||
from six.moves.urllib.parse import urlparse # pylint: disable=import-error
|
||||
|
||||
import third_party_auth
|
||||
from common.djangoapps import third_party_auth
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from third_party_auth import pipeline
|
||||
from common.djangoapps.third_party_auth import pipeline
|
||||
|
||||
|
||||
def third_party_auth_context(request, redirect_to, tpa_hint=None):
|
||||
|
||||
@@ -21,13 +21,13 @@ from openedx.core.djangoapps.django_comment_common.models import assign_role
|
||||
from openedx.core.djangoapps.user_authn.utils import generate_password
|
||||
from openedx.core.djangoapps.user_authn.views.registration_form import AccountCreationForm
|
||||
from openedx.features.course_experience import course_home_url_name
|
||||
from student.helpers import (
|
||||
from common.djangoapps.student.helpers import (
|
||||
AccountValidationError,
|
||||
authenticate_new_user,
|
||||
create_or_set_user_attribute_created_on_site,
|
||||
do_create_account
|
||||
)
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
CourseAccessRole,
|
||||
CourseEnrollment,
|
||||
Registration,
|
||||
@@ -35,7 +35,7 @@ from student.models import (
|
||||
anonymous_id_for_user,
|
||||
create_comments_service_user
|
||||
)
|
||||
from util.json_request import JsonResponse
|
||||
from common.djangoapps.util.json_request import JsonResponse
|
||||
|
||||
|
||||
def auto_auth(request): # pylint: disable=too-many-statements
|
||||
|
||||
@@ -28,7 +28,7 @@ from ratelimit.decorators import ratelimit
|
||||
from ratelimitbackend.exceptions import RateLimitException
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from common.djangoapps.edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.password_policy import compliance as password_policy_compliance
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_authn.views.login_form import get_login_session_form
|
||||
@@ -40,14 +40,14 @@ from openedx.core.djangoapps.user_authn.views.password_reset import send_passwor
|
||||
from openedx.core.djangoapps.user_authn.config.waffle import ENABLE_LOGIN_USING_THIRDPARTY_AUTH_ONLY
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.core.lib.api.view_utils import require_post_params
|
||||
from student.helpers import get_next_url_for_login_page
|
||||
from student.models import LoginFailures, AllowedAuthUser, UserProfile
|
||||
from student.views import compose_and_send_activation_email
|
||||
from third_party_auth import pipeline, provider
|
||||
import third_party_auth
|
||||
from track import segment
|
||||
from util.json_request import JsonResponse
|
||||
from util.password_policy_validators import normalize_password
|
||||
from common.djangoapps.student.helpers import get_next_url_for_login_page
|
||||
from common.djangoapps.student.models import LoginFailures, AllowedAuthUser, UserProfile
|
||||
from common.djangoapps.student.views import compose_and_send_activation_email
|
||||
from common.djangoapps.third_party_auth import pipeline, provider
|
||||
from common.djangoapps import third_party_auth
|
||||
from common.djangoapps.track import segment
|
||||
from common.djangoapps.util.json_request import JsonResponse
|
||||
from common.djangoapps.util.password_policy_validators import normalize_password
|
||||
|
||||
log = logging.getLogger("edx.student")
|
||||
AUDIT_LOG = logging.getLogger("audit")
|
||||
|
||||
@@ -14,8 +14,8 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from ratelimit.decorators import ratelimit
|
||||
|
||||
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 openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api import accounts
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import (
|
||||
@@ -36,10 +36,10 @@ from openedx.features.enterprise_support.utils import (
|
||||
handle_enterprise_cookies_for_logistration,
|
||||
update_logistration_context_for_enterprise
|
||||
)
|
||||
from student.helpers import get_next_url_for_login_page
|
||||
from third_party_auth import pipeline
|
||||
from third_party_auth.decorators import xframe_allow_whitelisted
|
||||
from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
from common.djangoapps.student.helpers import get_next_url_for_login_page
|
||||
from common.djangoapps.third_party_auth import pipeline
|
||||
from common.djangoapps.third_party_auth.decorators import xframe_allow_whitelisted
|
||||
from common.djangoapps.util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from six.moves.urllib.parse import parse_qs, urlsplit, urlunsplit # pylint: dis
|
||||
|
||||
from openedx.core.djangoapps.user_authn.cookies import delete_logged_in_cookies
|
||||
from openedx.core.djangoapps.user_authn.utils import is_safe_login_or_logout_redirect
|
||||
from third_party_auth import pipeline as tpa_pipeline
|
||||
from common.djangoapps.third_party_auth import pipeline as tpa_pipeline
|
||||
|
||||
|
||||
class LogoutView(TemplateView):
|
||||
|
||||
@@ -27,7 +27,7 @@ from eventtracking import tracker
|
||||
from ratelimit.decorators import ratelimit
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from common.djangoapps.edxmako.shortcuts import render_to_string
|
||||
from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
|
||||
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
|
||||
from openedx.core.djangoapps.oauth_dispatch.api import destroy_oauth_tokens
|
||||
@@ -41,10 +41,10 @@ from openedx.core.djangoapps.user_api.models import UserRetirementRequest
|
||||
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference
|
||||
from openedx.core.djangoapps.user_authn.message_types import PasswordReset, PasswordResetSuccess
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
from student.forms import send_account_recovery_email_for_user
|
||||
from student.models import AccountRecovery
|
||||
from util.json_request import JsonResponse
|
||||
from util.password_policy_validators import normalize_password, validate_password
|
||||
from common.djangoapps.student.forms import send_account_recovery_email_for_user
|
||||
from common.djangoapps.student.models import AccountRecovery
|
||||
from common.djangoapps.util.json_request import JsonResponse
|
||||
from common.djangoapps.util.password_policy_validators import normalize_password, validate_password
|
||||
|
||||
POST_EMAIL_KEY = 'post:email'
|
||||
REAL_IP_KEY = 'openedx.core.djangoapps.util.ratelimit.real_ip'
|
||||
|
||||
@@ -31,7 +31,7 @@ from six import text_type
|
||||
from social_core.exceptions import AuthAlreadyAssociated, AuthException
|
||||
from social_django import utils as social_utils
|
||||
|
||||
import third_party_auth
|
||||
from common.djangoapps import third_party_auth
|
||||
# Note that this lives in LMS, so this dependency should be refactored.
|
||||
# TODO Have the discussions code subscribe to the REGISTER_USER signal instead.
|
||||
from common.djangoapps.student.helpers import get_next_url_for_login_page
|
||||
@@ -57,25 +57,25 @@ from openedx.core.djangoapps.user_authn.views.registration_form import (
|
||||
RegistrationFormFactory,
|
||||
get_registration_extension_form
|
||||
)
|
||||
from student.helpers import (
|
||||
from common.djangoapps.student.helpers import (
|
||||
AccountValidationError,
|
||||
authenticate_new_user,
|
||||
create_or_set_user_attribute_created_on_site,
|
||||
do_create_account
|
||||
)
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
RegistrationCookieConfiguration,
|
||||
UserAttribute,
|
||||
create_comments_service_user,
|
||||
email_exists_or_retired,
|
||||
username_exists_or_retired
|
||||
)
|
||||
from student.views import compose_and_send_activation_email
|
||||
from third_party_auth import pipeline, provider
|
||||
from third_party_auth.saml import SAP_SUCCESSFACTORS_SAML_KEY
|
||||
from track import segment
|
||||
from util.db import outer_atomic
|
||||
from util.json_request import JsonResponse
|
||||
from common.djangoapps.student.views import compose_and_send_activation_email
|
||||
from common.djangoapps.third_party_auth import pipeline, provider
|
||||
from common.djangoapps.third_party_auth.saml import SAP_SUCCESSFACTORS_SAML_KEY
|
||||
from common.djangoapps.track import segment
|
||||
from common.djangoapps.util.db import outer_atomic
|
||||
from common.djangoapps.util.json_request import JsonResponse
|
||||
|
||||
log = logging.getLogger("edx.student")
|
||||
AUDIT_LOG = logging.getLogger("audit")
|
||||
|
||||
@@ -18,20 +18,20 @@ from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django_countries import countries
|
||||
|
||||
import third_party_auth
|
||||
from edxmako.shortcuts import marketing_link
|
||||
from common.djangoapps import third_party_auth
|
||||
from common.djangoapps.edxmako.shortcuts import marketing_link
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api import accounts
|
||||
from openedx.core.djangoapps.user_api.helpers import FormDescription
|
||||
from openedx.core.djangoapps.user_authn.utils import is_registration_api_v1 as is_api_v1
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.features.enterprise_support.api import enterprise_customer_for_request
|
||||
from student.models import (
|
||||
from common.djangoapps.student.models import (
|
||||
CourseEnrollmentAllowed,
|
||||
UserProfile,
|
||||
email_exists_or_retired,
|
||||
)
|
||||
from util.password_policy_validators import (
|
||||
from common.djangoapps.util.password_policy_validators import (
|
||||
password_validators_instruction_texts,
|
||||
password_validators_restrictions,
|
||||
validate_password,
|
||||
|
||||
@@ -19,8 +19,8 @@ from openedx.core.djangoapps.django_comment_common.models import (
|
||||
Role
|
||||
)
|
||||
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
|
||||
from student.models import CourseAccessRole, CourseEnrollment, UserProfile, anonymous_id_for_user
|
||||
from util.testing import UrlResetMixin
|
||||
from common.djangoapps.student.models import CourseAccessRole, CourseEnrollment, UserProfile, anonymous_id_for_user
|
||||
from common.djangoapps.util.testing import UrlResetMixin
|
||||
|
||||
|
||||
class AutoAuthTestCase(UrlResetMixin, TestCase):
|
||||
|
||||
@@ -20,8 +20,7 @@ from django.test.utils import override_settings
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
from mock import patch
|
||||
from student.tests.factories import RegistrationFactory, UserFactory, UserProfileFactory
|
||||
from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
from common.djangoapps.student.tests.factories import RegistrationFactory, UserFactory, UserProfileFactory
|
||||
|
||||
from openedx.core.djangoapps.password_policy.compliance import (
|
||||
NonCompliantPasswordException,
|
||||
@@ -38,6 +37,7 @@ from openedx.core.djangoapps.user_authn.views.login import (
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
from openedx.core.lib.api.test_utils import ApiTestCase
|
||||
from common.djangoapps.util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -74,7 +74,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
|
||||
def test_login_success(self):
|
||||
response, mock_audit_log = self._login_response(
|
||||
self.user_email, self.password, patched_audit_log='student.models.AUDIT_LOG'
|
||||
self.user_email, self.password, patched_audit_log='common.djangoapps.student.models.AUDIT_LOG'
|
||||
)
|
||||
self._assert_response(response, success=True)
|
||||
self._assert_audit_log(mock_audit_log, 'info', [u'Login success', self.user_email])
|
||||
@@ -160,7 +160,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
@patch.dict("django.conf.settings.FEATURES", {'SQUELCH_PII_IN_LOGS': True})
|
||||
def test_login_success_no_pii(self):
|
||||
response, mock_audit_log = self._login_response(
|
||||
self.user_email, self.password, patched_audit_log='student.models.AUDIT_LOG'
|
||||
self.user_email, self.password, patched_audit_log='common.djangoapps.student.models.AUDIT_LOG'
|
||||
)
|
||||
self._assert_response(response, success=True)
|
||||
self._assert_audit_log(mock_audit_log, 'info', [u'Login success'])
|
||||
@@ -172,7 +172,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
self.user.save()
|
||||
|
||||
response, mock_audit_log = self._login_response(
|
||||
unicode_email, self.password, patched_audit_log='student.models.AUDIT_LOG'
|
||||
unicode_email, self.password, patched_audit_log='common.djangoapps.student.models.AUDIT_LOG'
|
||||
)
|
||||
self._assert_response(response, success=True)
|
||||
self._assert_audit_log(mock_audit_log, 'info', [u'Login success', unicode_email])
|
||||
@@ -283,7 +283,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
response, _ = self._login_response(self.user_email, self.password)
|
||||
self._assert_response(response, success=True)
|
||||
logout_url = reverse('logout')
|
||||
with patch('student.models.AUDIT_LOG') as mock_audit_log:
|
||||
with patch('common.djangoapps.student.models.AUDIT_LOG') as mock_audit_log:
|
||||
response = self.client.post(logout_url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self._assert_audit_log(mock_audit_log, 'info', [u'Logout', u'test'])
|
||||
@@ -343,7 +343,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
response, _ = self._login_response(self.user_email, self.password)
|
||||
self._assert_response(response, success=True)
|
||||
logout_url = reverse('logout')
|
||||
with patch('student.models.AUDIT_LOG') as mock_audit_log:
|
||||
with patch('common.djangoapps.student.models.AUDIT_LOG') as mock_audit_log:
|
||||
response = self.client.post(logout_url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self._assert_audit_log(mock_audit_log, 'info', [u'Logout'])
|
||||
|
||||
@@ -22,7 +22,7 @@ from django.utils.translation import ugettext as _
|
||||
from freezegun import freeze_time
|
||||
from pytz import UTC
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from lms.djangoapps.branding.api import get_privacy_url
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context
|
||||
@@ -30,8 +30,8 @@ from openedx.core.djangoapps.user_authn.views.login_form import login_and_regist
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
from util.testing import UrlResetMixin
|
||||
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
from common.djangoapps.util.testing import UrlResetMixin
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
|
||||
}
|
||||
pipeline_target = 'openedx.core.djangoapps.user_authn.views.login_form.third_party_auth.pipeline'
|
||||
with simulate_running_pipeline(pipeline_target, current_backend, **pipeline_response):
|
||||
with mock.patch('edxmako.request_context.get_current_request', return_value=request):
|
||||
with mock.patch('common.djangoapps.edxmako.request_context.get_current_request', return_value=request):
|
||||
response = login_and_registration_form(request)
|
||||
|
||||
expected_error_message = Text(_(
|
||||
|
||||
@@ -14,7 +14,7 @@ from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
from openedx.core.djangoapps.oauth_dispatch.tests.factories import ApplicationFactory
|
||||
from student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
|
||||
@@ -52,15 +52,15 @@ from openedx.core.djangoapps.user_api.tests.test_views import UserAPITestCase
|
||||
from openedx.core.djangoapps.user_authn.views.register import REGISTRATION_FAILURE_LOGGING_FLAG
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from openedx.core.lib.api import test_utils
|
||||
from student.helpers import authenticate_new_user
|
||||
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.helpers import authenticate_new_user
|
||||
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 (
|
||||
DEFAULT_MAX_PASSWORD_LENGTH,
|
||||
create_validator_config,
|
||||
password_validators_instruction_texts,
|
||||
@@ -473,9 +473,15 @@ class RegistrationViewTestV1(ThirdPartyAuthTestMixin, UserAPITestCase):
|
||||
)
|
||||
|
||||
@override_settings(AUTH_PASSWORD_VALIDATORS=[
|
||||
create_validator_config('util.password_policy_validators.MinimumLengthValidator', {'min_length': 2}),
|
||||
create_validator_config('util.password_policy_validators.UppercaseValidator', {'min_upper': 3}),
|
||||
create_validator_config('util.password_policy_validators.SymbolValidator', {'min_symbol': 1}),
|
||||
create_validator_config(
|
||||
'common.djangoapps.util.password_policy_validators.MinimumLengthValidator', {'min_length': 2}
|
||||
),
|
||||
create_validator_config(
|
||||
'common.djangoapps.util.password_policy_validators.UppercaseValidator', {'min_upper': 3}
|
||||
),
|
||||
create_validator_config(
|
||||
'common.djangoapps.util.password_policy_validators.SymbolValidator', {'min_symbol': 1}
|
||||
),
|
||||
])
|
||||
def test_register_form_password_complexity(self):
|
||||
no_extra_fields_setting = {}
|
||||
|
||||
@@ -37,13 +37,13 @@ from openedx.core.djangoapps.user_authn.views.password_reset import (
|
||||
SETTING_CHANGE_INITIATED, password_reset, password_reset_logistration,
|
||||
PasswordResetConfirmWrapper)
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
from student.tests.test_configuration_overrides import fake_get_value
|
||||
from student.tests.test_email import mock_render_to_string
|
||||
from student.models import AccountRecovery
|
||||
from common.djangoapps.student.tests.factories import TEST_PASSWORD, UserFactory
|
||||
from common.djangoapps.student.tests.test_configuration_overrides import fake_get_value
|
||||
from common.djangoapps.student.tests.test_email import mock_render_to_string
|
||||
from common.djangoapps.student.models import AccountRecovery
|
||||
|
||||
from util.password_policy_validators import create_validator_config
|
||||
from util.testing import EventTestMixin
|
||||
from common.djangoapps.util.password_policy_validators import create_validator_config
|
||||
from common.djangoapps.util.testing import EventTestMixin
|
||||
|
||||
|
||||
ENABLE_LOGISTRATION_MICROFRONTEND = settings.FEATURES.copy()
|
||||
@@ -541,8 +541,12 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
|
||||
})
|
||||
|
||||
@override_settings(AUTH_PASSWORD_VALIDATORS=[
|
||||
create_validator_config('util.password_policy_validators.MinimumLengthValidator', {'min_length': 2}),
|
||||
create_validator_config('util.password_policy_validators.MaximumLengthValidator', {'max_length': 10})
|
||||
create_validator_config(
|
||||
'common.djangoapps.util.password_policy_validators.MinimumLengthValidator', {'min_length': 2}
|
||||
),
|
||||
create_validator_config(
|
||||
'common.djangoapps.util.password_policy_validators.MaximumLengthValidator', {'max_length': 10}
|
||||
),
|
||||
])
|
||||
@ddt.data(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user