From a2f5a46a68a267a387ddd14d11f318a27acfca53 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Thu, 18 Mar 2021 11:30:38 +0500 Subject: [PATCH] refactor: Pyupgrade in common/djangoapps/third-party-auth/tests. --- .../third_party_auth/api/permissions.py | 2 +- .../third_party_auth/api/serializers.py | 2 +- .../api/tests/test_permissions.py | 2 +- .../third_party_auth/api/tests/test_views.py | 33 +++++----- .../djangoapps/third_party_auth/api/urls.py | 4 +- .../djangoapps/third_party_auth/api/views.py | 16 ++--- .../third_party_auth/config/waffle.py | 2 +- .../commands/remove_social_auth_users.py | 7 +- .../management/commands/saml.py | 11 ++-- .../tests/test_remove_social_auth_users.py | 8 +-- .../management/commands/tests/test_saml.py | 6 +- .../migrations/0001_initial.py | 65 +++++++++---------- .../0002_schema__provider_icon_image.py | 15 ++--- .../0003_samlproviderconfig_debug_mode.py | 5 +- .../migrations/0004_add_visible_field.py | 15 ++--- .../migrations/0005_add_site_field.py | 5 +- ...roviderconfig_automatic_refresh_enabled.py | 5 +- .../migrations/0007_auto_20170406_0912.py | 7 +- .../migrations/0008_auto_20170413_1455.py | 3 - .../migrations/0009_auto_20170415_1144.py | 9 +-- ...0010_add_skip_hinted_login_dialog_field.py | 3 - .../migrations/0011_auto_20170616_0112.py | 5 +- .../migrations/0012_auto_20170626_1135.py | 3 - .../0013_sync_learner_profile_data.py | 3 - .../migrations/0014_auto_20171222_1233.py | 3 - .../0015_samlproviderconfig_archived.py | 3 - .../migrations/0016_auto_20180130_0938.py | 5 +- ...emove_icon_class_image_secondary_fields.py | 1 - .../migrations/0018_auto_20180327_1631.py | 3 - .../migrations/0019_consolidate_slug.py | 7 +- .../migrations/0020_cleanup_slug_fields.py | 1 - .../migrations/0021_sso_id_verification.py | 7 +- .../migrations/0022_auto_20181012_0307.py | 11 ++-- .../migrations/0023_auto_20190418_2033.py | 1 - .../migrations/0024_fix_edit_disallowed.py | 1 - .../migrations/0025_auto_20200303_1448.py | 1 - .../third_party_auth/tests/test_views.py | 2 +- 37 files changed, 110 insertions(+), 172 deletions(-) diff --git a/common/djangoapps/third_party_auth/api/permissions.py b/common/djangoapps/third_party_auth/api/permissions.py index af7874c12b..2f8e2779c4 100644 --- a/common/djangoapps/third_party_auth/api/permissions.py +++ b/common/djangoapps/third_party_auth/api/permissions.py @@ -60,5 +60,5 @@ _JWT_RESTRICTED_TPA_PERMISSIONS = ( JwtHasTpaProviderFilterForRequestedProvider ) TPA_PERMISSIONS = ( - (_NOT_JWT_RESTRICTED_TPA_PERMISSIONS | _JWT_RESTRICTED_TPA_PERMISSIONS) + _NOT_JWT_RESTRICTED_TPA_PERMISSIONS | _JWT_RESTRICTED_TPA_PERMISSIONS ) diff --git a/common/djangoapps/third_party_auth/api/serializers.py b/common/djangoapps/third_party_auth/api/serializers.py index 4a4eaa88e4..3e8513de73 100644 --- a/common/djangoapps/third_party_auth/api/serializers.py +++ b/common/djangoapps/third_party_auth/api/serializers.py @@ -12,7 +12,7 @@ class UserMappingSerializer(serializers.Serializer): # pylint: disable=abstract def __init__(self, *args, **kwargs): self.provider = kwargs['context'].get('provider', None) - super(UserMappingSerializer, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments + super().__init__(*args, **kwargs) def get_username(self, social_user): """ Gets the edx username from a social user """ diff --git a/common/djangoapps/third_party_auth/api/tests/test_permissions.py b/common/djangoapps/third_party_auth/api/tests/test_permissions.py index 4120b06fc5..386e455108 100644 --- a/common/djangoapps/third_party_auth/api/tests/test_permissions.py +++ b/common/djangoapps/third_party_auth/api/tests/test_permissions.py @@ -48,7 +48,7 @@ class ThirdPartyAuthPermissionTest(TestCase): def _create_jwt_header(self, user, is_restricted=False, scopes=None, filters=None): token = generate_jwt(user, is_restricted=is_restricted, scopes=scopes, filters=filters) - return "JWT {}".format(token) + return f"JWT {token}" def test_anonymous_fails(self): request = self._create_request() diff --git a/common/djangoapps/third_party_auth/api/tests/test_views.py b/common/djangoapps/third_party_auth/api/tests/test_views.py index 6a57edef0b..ce6da78c6b 100644 --- a/common/djangoapps/third_party_auth/api/tests/test_views.py +++ b/common/djangoapps/third_party_auth/api/tests/test_views.py @@ -4,6 +4,7 @@ Tests for the Third Party Auth REST API import unittest +from unittest.mock import patch import ddt import six @@ -12,9 +13,7 @@ from django.http import QueryDict from django.test.utils import override_settings from django.urls import reverse from edx_rest_framework_extensions.auth.jwt.tests.utils import generate_jwt -from mock import patch from rest_framework.test import APITestCase -from six.moves import range from social_django.models import UserSocialAuth from common.djangoapps.student.tests.factories import UserFactory @@ -49,7 +48,7 @@ class TpaAPITestCase(ThirdPartyAuthTestMixin, APITestCase): def setUp(self): # pylint: disable=arguments-differ """ Create users for use in the tests """ - super(TpaAPITestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() google = self.configure_google_provider(enabled=True) self.configure_facebook_provider(enabled=True) @@ -67,7 +66,7 @@ class TpaAPITestCase(ThirdPartyAuthTestMixin, APITestCase): make_staff = (username == STAFF_USERNAME) or make_superuser user = UserFactory.create( username=username, - email='{}@example.com'.format(username), + email=f'{username}@example.com', password=PASSWORD, is_staff=make_staff, is_superuser=make_superuser, @@ -75,19 +74,19 @@ class TpaAPITestCase(ThirdPartyAuthTestMixin, APITestCase): UserSocialAuth.objects.create( user=user, provider=google.backend_name, - uid='{}@gmail.com'.format(username), + uid=f'{username}@gmail.com', ) UserSocialAuth.objects.create( user=user, provider=testshib.backend_name, - uid='{}:remote_{}'.format(testshib.slug, username), + uid=f'{testshib.slug}:remote_{username}', ) # Create another user not linked to any providers: - UserFactory.create(username=CARL_USERNAME, email='{}@example.com'.format(CARL_USERNAME), password=PASSWORD) + UserFactory.create(username=CARL_USERNAME, email=f'{CARL_USERNAME}@example.com', password=PASSWORD) @ddt.ddt -class UserViewsMixin(object): +class UserViewsMixin: """ Generic TestCase to exercise the v1 and v2 UserViews. """ @@ -100,7 +99,7 @@ class UserViewsMixin(object): { "provider_id": "oa2-google-oauth2", "name": "Google", - "remote_id": "{}@gmail.com".format(username), + "remote_id": f"{username}@gmail.com", }, { "provider_id": PROVIDER_ID_TESTSHIB, @@ -134,7 +133,7 @@ class UserViewsMixin(object): assert response.status_code == expect_result if expect_result == 200: assert 'active' in response.data - six.assertCountEqual(self, response.data["active"], self.expected_active(target_user)) + self.assertCountEqual(response.data["active"], self.expected_active(target_user)) @ddt.data( # A server with a valid API key can query any user's list of providers @@ -150,7 +149,7 @@ class UserViewsMixin(object): assert response.status_code == expect_result if expect_result == 200: assert 'active' in response.data - six.assertCountEqual(self, response.data["active"], self.expected_active(target_user)) + self.assertCountEqual(response.data["active"], self.expected_active(target_user)) @ddt.data( (True, ALICE_USERNAME, 200, True), @@ -172,7 +171,7 @@ class UserViewsMixin(object): def test_allow_query_by_email(self): self.client.login(username=ALICE_USERNAME, password=PASSWORD) - url = self.make_url({'email': '{}@example.com'.format(ALICE_USERNAME)}) + url = self.make_url({'email': f'{ALICE_USERNAME}@example.com'}) response = self.client.get(url) assert response.status_code == 200 assert len(response.data['active']) > 0 @@ -247,7 +246,7 @@ class UserMappingViewAPITests(TpaAPITestCase): def _create_jwt_header(self, user, is_restricted=False, scopes=None, filters=None): token = generate_jwt(user, is_restricted=is_restricted, scopes=scopes, filters=filters) - return "JWT {}".format(token) + return f"JWT {token}" @ddt.data( (True, 200, get_mapping_data_by_usernames(LINKED_USERS)), @@ -311,7 +310,7 @@ class UserMappingViewAPITests(TpaAPITestCase): for attr in ['username', 'remote_id']: if attr in query_params: params.setlist(attr, query_params[attr]) - url = "{}?{}".format(base_url, params.urlencode()) + url = f"{base_url}?{params.urlencode()}" response = self.client.get(url, HTTP_X_EDX_API_KEY=VALID_API_KEY) self._verify_response(response, expect_code, expect_data) @@ -327,7 +326,7 @@ class UserMappingViewAPITests(TpaAPITestCase): UserSocialAuth.objects.create( user=user, provider=testshib2.backend_name, - uid='{}:{}'.format(testshib2.slug, username), + uid=f'{testshib2.slug}:{username}', ) url = reverse('third_party_auth_user_mapping_api', kwargs={'provider_id': PROVIDER_ID_TESTSHIB}) @@ -354,7 +353,7 @@ class UserMappingViewAPITests(TpaAPITestCase): if expect_code == 200: for item in ['results', 'count', 'num_pages']: assert item in response.data - six.assertCountEqual(self, response.data['results'], expect_result) + self.assertCountEqual(response.data['results'], expect_result) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @@ -364,7 +363,7 @@ class TestThirdPartyAuthUserStatusView(ThirdPartyAuthTestMixin, APITestCase): """ def setUp(self, *args, **kwargs): - super(TestThirdPartyAuthUserStatusView, self).setUp(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments + super().setUp(*args, **kwargs) self.user = UserFactory.create(password=PASSWORD) self.google_provider = self.configure_google_provider(enabled=True, visible=True) self.url = reverse('third_party_auth_user_status_api') diff --git a/common/djangoapps/third_party_auth/api/urls.py b/common/djangoapps/third_party_auth/api/urls.py index 01b12c35da..bca2f7bbb0 100644 --- a/common/djangoapps/third_party_auth/api/urls.py +++ b/common/djangoapps/third_party_auth/api/urls.py @@ -10,13 +10,13 @@ PROVIDER_PATTERN = r'(?P[\w.+-]+)(?:\:(?P[\w.+-]+))?' urlpatterns = [ url( - r'^v0/users/{username_pattern}$'.format(username_pattern=settings.USERNAME_PATTERN), + fr'^v0/users/{settings.USERNAME_PATTERN}$', UserView.as_view(), name='third_party_auth_users_api', ), url(r'^v0/users/', UserViewV2.as_view(), name='third_party_auth_users_api_v2'), url( - r'^v0/providers/{provider_pattern}/users$'.format(provider_pattern=PROVIDER_PATTERN), + fr'^v0/providers/{PROVIDER_PATTERN}/users$', UserMappingView.as_view(), name='third_party_auth_user_mapping_api', ), diff --git a/common/djangoapps/third_party_auth/api/views.py b/common/djangoapps/third_party_auth/api/views.py index 165f18536f..97d1a7d6db 100644 --- a/common/djangoapps/third_party_auth/api/views.py +++ b/common/djangoapps/third_party_auth/api/views.py @@ -40,7 +40,7 @@ class ProviderBaseThrottle(throttling.UserRateThrottle): Only throttle unprivileged requests. """ if view.is_unprivileged_query(request, view.get_identifier_for_requested_user(request)): - return super(ProviderBaseThrottle, self).allow_request(request, view) # lint-amnesty, pylint: disable=super-with-arguments + return super().allow_request(request, view) return True @@ -123,7 +123,7 @@ class BaseUserView(APIView): if identifier.kind not in self.identifier_kinds: # This is already checked before we get here, so raise a 500 error # if the check fails. - raise ValueError(u"Identifier kind {} not in {}".format(identifier.kind, self.identifier_kinds)) + raise ValueError(f"Identifier kind {identifier.kind} not in {self.identifier_kinds}") self_request = False if identifier == self.identifier('username', request.user.username): @@ -195,11 +195,11 @@ class UserView(BaseUserView): """ Return an identifier namedtuple for the requested user. """ - if u'@' in self.kwargs[u'username']: - id_kind = u'email' + if '@' in self.kwargs['username']: + id_kind = 'email' else: - id_kind = u'username' - return self.identifier(id_kind, self.kwargs[u'username']) + id_kind = 'username' + return self.identifier(id_kind, self.kwargs['username']) # TODO: When removing deprecated UserView, rename this view to UserView. @@ -260,7 +260,7 @@ class UserViewV2(BaseUserView): identifier = self.identifier(id_kind, request.GET[id_kind]) break if identifier is None: - raise exceptions.ValidationError(u"Must provide one of {}".format(self.identifier_kinds)) + raise exceptions.ValidationError(f"Must provide one of {self.identifier_kinds}") return identifier @@ -378,7 +378,7 @@ class UserMappingView(ListAPIView): Extra context provided to the serializer class with current provider. We need the provider to remove idp_slug from the remote_id if there is any """ - context = super(UserMappingView, self).get_serializer_context() # lint-amnesty, pylint: disable=super-with-arguments + context = super().get_serializer_context() context['provider'] = self.provider return context diff --git a/common/djangoapps/third_party_auth/config/waffle.py b/common/djangoapps/third_party_auth/config/waffle.py index 802ef93f5f..92c6c54c6a 100644 --- a/common/djangoapps/third_party_auth/config/waffle.py +++ b/common/djangoapps/third_party_auth/config/waffle.py @@ -17,6 +17,6 @@ WAFFLE_NAMESPACE = 'third_party_auth' # .. toggle_target_removal_date: 2021-04-31 # .. toggle_tickets: ENT-4034 ENABLE_MULTIPLE_SSO_ACCOUNTS_ASSOCIATION_TO_SAML_USER = WaffleSwitch( - '{NAMESPACE}.enable_multiple_sso_accounts_association_to_saml_user'.format(NAMESPACE=WAFFLE_NAMESPACE), + f'{WAFFLE_NAMESPACE}.enable_multiple_sso_accounts_association_to_saml_user', __name__ ) diff --git a/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py b/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py index 4858ca4d93..798816d4c1 100644 --- a/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py +++ b/common/djangoapps/third_party_auth/management/commands/remove_social_auth_users.py @@ -10,7 +10,6 @@ from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.management.base import BaseCommand, CommandError from django.db import transaction -from six.moves import input from common.djangoapps.third_party_auth.models import SAMLProviderConfig @@ -45,13 +44,13 @@ class Command(BaseCommand): try: SAMLProviderConfig.objects.current_set().get(slug=slug) except SAMLProviderConfig.DoesNotExist: - raise CommandError(u'No SAML provider found for slug {}'.format(slug)) # lint-amnesty, pylint: disable=raise-missing-from + raise CommandError(f'No SAML provider found for slug {slug}') # lint-amnesty, pylint: disable=raise-missing-from users = User.objects.filter(social_auth__provider=slug) user_count = len(users) count, models = users.delete() log.info( - u'\n%s users and their related models will be deleted:\n%s\n', + '\n%s users and their related models will be deleted:\n%s\n', user_count, models, ) @@ -61,4 +60,4 @@ class Command(BaseCommand): if confirmation != 'confirm': raise CommandError('User confirmation required. No records have been modified') - log.info(u'Deleting %s records...', count) + log.info('Deleting %s records...', count) diff --git a/common/djangoapps/third_party_auth/management/commands/saml.py b/common/djangoapps/third_party_auth/management/commands/saml.py index 13a5304dd9..bb44dc5d02 100644 --- a/common/djangoapps/third_party_auth/management/commands/saml.py +++ b/common/djangoapps/third_party_auth/management/commands/saml.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Management commands for third_party_auth """ @@ -31,10 +30,10 @@ class Command(BaseCommand): log.addHandler(log_handler) total, skipped, attempted, updated, failed, failure_messages = fetch_saml_metadata() self.stdout.write( - u"\nDone." - u"\n{total} provider(s) found in database." - u"\n{skipped} skipped and {attempted} attempted." - u"\n{updated} updated and {failed} failed.\n".format( + "\nDone." + "\n{total} provider(s) found in database." + "\n{skipped} skipped and {attempted} attempted." + "\n{updated} updated and {failed} failed.\n".format( total=total, skipped=skipped, attempted=attempted, updated=updated, failed=failed, @@ -43,7 +42,7 @@ class Command(BaseCommand): if failed > 0: raise CommandError( - u"Command finished with the following exceptions:\n\n{failures}".format( + "Command finished with the following exceptions:\n\n{failures}".format( failures="\n\n".join(failure_messages) ) ) diff --git a/common/djangoapps/third_party_auth/management/commands/tests/test_remove_social_auth_users.py b/common/djangoapps/third_party_auth/management/commands/tests/test_remove_social_auth_users.py index e809e1c1e4..eb13a1e394 100644 --- a/common/djangoapps/third_party_auth/management/commands/tests/test_remove_social_auth_users.py +++ b/common/djangoapps/third_party_auth/management/commands/tests/test_remove_social_auth_users.py @@ -32,11 +32,11 @@ class TestRemoveSocialAuthUsersCommand(TestCase): """ @classmethod def setUpClass(cls): - super(TestRemoveSocialAuthUsersCommand, cls).setUpClass() + super().setUpClass() cls.command = remove_social_auth_users.Command() def setUp(self): - super(TestRemoveSocialAuthUsersCommand, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.provider_hogwarts = SAMLProviderConfigFactory.create(slug='hogwarts') self.provider_durmstrang = SAMLProviderConfigFactory.create(slug='durmstrang') @@ -58,7 +58,7 @@ class TestRemoveSocialAuthUsersCommand(TestCase): external_id = uuid4() UserSocialAuth.objects.create( user=user, - uid='{0}:{1}'.format(provider.slug, external_id), + uid=f'{provider.slug}:{external_id}', provider=provider.slug, ) @@ -87,7 +87,7 @@ class TestRemoveSocialAuthUsersCommand(TestCase): @override_settings(FEATURES=FEATURES_WITH_ENABLED) def test_invalid_idp(self): invalid_slug = 'jedi-academy' - err_string = u'No SAML provider found for slug {}'.format(invalid_slug) + err_string = f'No SAML provider found for slug {invalid_slug}' with self.assertRaisesRegex(CommandError, err_string): call_command(self.command, invalid_slug) diff --git a/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py b/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py index 1c752a7ec4..390839f8bf 100644 --- a/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py +++ b/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py @@ -7,7 +7,7 @@ existing data accordingly. import os import unittest -import mock +from unittest import mock from django.conf import settings from django.core.management import call_command from django.core.management.base import CommandError @@ -34,7 +34,7 @@ def mock_get(status_code=200): """ url = url.split("/")[-1] if url else "testshib-providers.xml" - file_path = os.path.dirname(os.path.realpath(__file__)) + "/test_data/{}".format(url) + file_path = os.path.dirname(os.path.realpath(__file__)) + f"/test_data/{url}" with open(file_path) as providers: xml = providers.read() @@ -56,7 +56,7 @@ class TestSAMLCommand(CacheIsolationTestCase): Setup operations for saml configurations. these operations contain creation of SAMLConfiguration and SAMLProviderConfig records in database. """ - super(TestSAMLCommand, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.stdout = StringIO() diff --git a/common/djangoapps/third_party_auth/migrations/0001_initial.py b/common/djangoapps/third_party_auth/migrations/0001_initial.py index f67d69e844..eb844f7a08 100644 --- a/common/djangoapps/third_party_auth/migrations/0001_initial.py +++ b/common/djangoapps/third_party_auth/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - import django.db.models.deletion from openedx.core.lib.hash_utils import create_hash256 from django.conf import settings @@ -20,15 +17,15 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('icon_class', models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), - ('name', models.CharField(help_text=u'Name of this provider (shown to users)', max_length=50)), + ('icon_class', models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), + ('name', models.CharField(help_text='Name of this provider (shown to users)', max_length=50)), ('secondary', models.BooleanField(default=False, help_text='Secondary providers are displayed less prominently, in a separate list of "Institution" login providers.')), ('skip_registration_form', models.BooleanField(default=False, help_text='If this option is enabled, users will not be asked to confirm their details (name, email, etc.) during the registration process. Only select this option for trusted providers that are known to provide accurate user information.')), ('skip_email_verification', models.BooleanField(default=False, help_text='If this option is selected, users will not be required to confirm their email, and their account will be activated immediately upon registration.')), - ('lti_consumer_key', models.CharField(help_text=u'The name that the LTI Tool Consumer will use to identify itself', max_length=255)), - ('lti_hostname', models.CharField(default=u'localhost', help_text=u'The domain that will be acting as the LTI consumer.', max_length=255, db_index=True)), - ('lti_consumer_secret', models.CharField(default=create_hash256, help_text=u'The shared secret that the LTI Tool Consumer will use to authenticate requests. Only this edX instance and this tool consumer instance should know this value. For increased security, you can avoid storing this in your database by leaving this field blank and setting SOCIAL_AUTH_LTI_CONSUMER_SECRETS = {"consumer key": "secret", ...} in your instance\'s Django setttigs (or lms.auth.json)', max_length=255, blank=True)), - ('lti_max_timestamp_age', models.IntegerField(default=10, help_text=u'The maximum age of oauth_timestamp values, in seconds.')), + ('lti_consumer_key', models.CharField(help_text='The name that the LTI Tool Consumer will use to identify itself', max_length=255)), + ('lti_hostname', models.CharField(default='localhost', help_text='The domain that will be acting as the LTI consumer.', max_length=255, db_index=True)), + ('lti_consumer_secret', models.CharField(default=create_hash256, help_text='The shared secret that the LTI Tool Consumer will use to authenticate requests. Only this edX instance and this tool consumer instance should know this value. For increased security, you can avoid storing this in your database by leaving this field blank and setting SOCIAL_AUTH_LTI_CONSUMER_SECRETS = {"consumer key": "secret", ...} in your instance\'s Django setttigs (or lms.auth.json)', max_length=255, blank=True)), + ('lti_max_timestamp_age', models.IntegerField(default=10, help_text='The maximum age of oauth_timestamp values, in seconds.')), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], options={ @@ -42,15 +39,15 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('icon_class', models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), - ('name', models.CharField(help_text=u'Name of this provider (shown to users)', max_length=50)), + ('icon_class', models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), + ('name', models.CharField(help_text='Name of this provider (shown to users)', max_length=50)), ('secondary', models.BooleanField(default=False, help_text='Secondary providers are displayed less prominently, in a separate list of "Institution" login providers.')), ('skip_registration_form', models.BooleanField(default=False, help_text='If this option is enabled, users will not be asked to confirm their details (name, email, etc.) during the registration process. Only select this option for trusted providers that are known to provide accurate user information.')), ('skip_email_verification', models.BooleanField(default=False, help_text='If this option is selected, users will not be required to confirm their email, and their account will be activated immediately upon registration.')), - ('backend_name', models.CharField(help_text=u'Which python-social-auth OAuth2 provider backend to use. The list of backend choices is determined by the THIRD_PARTY_AUTH_BACKENDS setting.', max_length=50, db_index=True)), - ('key', models.TextField(verbose_name=u'Client ID', blank=True)), - ('secret', models.TextField(help_text=u'For increased security, you can avoid storing this in your database by leaving this field blank and setting SOCIAL_AUTH_OAUTH_SECRETS = {"(backend name)": "secret", ...} in your instance\'s Django settings (or lms.auth.json)', verbose_name=u'Client Secret', blank=True)), - ('other_settings', models.TextField(help_text=u'Optional JSON object with advanced settings, if any.', blank=True)), + ('backend_name', models.CharField(help_text='Which python-social-auth OAuth2 provider backend to use. The list of backend choices is determined by the THIRD_PARTY_AUTH_BACKENDS setting.', max_length=50, db_index=True)), + ('key', models.TextField(verbose_name='Client ID', blank=True)), + ('secret', models.TextField(help_text='For increased security, you can avoid storing this in your database by leaving this field blank and setting SOCIAL_AUTH_OAUTH_SECRETS = {"(backend name)": "secret", ...} in your instance\'s Django settings (or lms.auth.json)', verbose_name='Client Secret', blank=True)), + ('other_settings', models.TextField(help_text='Optional JSON object with advanced settings, if any.', blank=True)), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], options={ @@ -64,11 +61,11 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('private_key', models.TextField(help_text=u'To generate a key pair as two files, run "openssl req -new -x509 -days 3652 -nodes -out saml.crt -keyout saml.key". Paste the contents of saml.key here. For increased security, you can avoid storing this in your database by leaving this field blank and setting it via the SOCIAL_AUTH_SAML_SP_PRIVATE_KEY setting in your instance\'s Django settings (or lms.auth.json).', blank=True)), - ('public_key', models.TextField(help_text=u"Public key certificate. For increased security, you can avoid storing this in your database by leaving this field blank and setting it via the SOCIAL_AUTH_SAML_SP_PUBLIC_CERT setting in your instance's Django settings (or lms.auth.json).", blank=True)), - ('entity_id', models.CharField(default=u'http://saml.example.com', max_length=255, verbose_name=u'Entity ID')), - ('org_info_str', models.TextField(default=u'{"en-US": {"url": "http://www.example.com", "displayname": "Example Inc.", "name": "example"}}', help_text=u"JSON dictionary of 'url', 'displayname', and 'name' for each language", verbose_name=u'Organization Info')), - ('other_config_str', models.TextField(default=u'{\n"SECURITY_CONFIG": {"metadataCacheDuration": 604800, "signMetadata": false}\n}', help_text=u'JSON object defining advanced settings that are passed on to python-saml. Valid keys that can be set here include: SECURITY_CONFIG and SP_EXTRA')), + ('private_key', models.TextField(help_text='To generate a key pair as two files, run "openssl req -new -x509 -days 3652 -nodes -out saml.crt -keyout saml.key". Paste the contents of saml.key here. For increased security, you can avoid storing this in your database by leaving this field blank and setting it via the SOCIAL_AUTH_SAML_SP_PRIVATE_KEY setting in your instance\'s Django settings (or lms.auth.json).', blank=True)), + ('public_key', models.TextField(help_text="Public key certificate. For increased security, you can avoid storing this in your database by leaving this field blank and setting it via the SOCIAL_AUTH_SAML_SP_PUBLIC_CERT setting in your instance's Django settings (or lms.auth.json).", blank=True)), + ('entity_id', models.CharField(default='http://saml.example.com', max_length=255, verbose_name='Entity ID')), + ('org_info_str', models.TextField(default='{"en-US": {"url": "http://www.example.com", "displayname": "Example Inc.", "name": "example"}}', help_text="JSON dictionary of 'url', 'displayname', and 'name' for each language", verbose_name='Organization Info')), + ('other_config_str', models.TextField(default='{\n"SECURITY_CONFIG": {"metadataCacheDuration": 604800, "signMetadata": false}\n}', help_text='JSON object defining advanced settings that are passed on to python-saml. Valid keys that can be set here include: SECURITY_CONFIG and SP_EXTRA')), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], options={ @@ -82,22 +79,22 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('icon_class', models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), - ('name', models.CharField(help_text=u'Name of this provider (shown to users)', max_length=50)), + ('icon_class', models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50)), + ('name', models.CharField(help_text='Name of this provider (shown to users)', max_length=50)), ('secondary', models.BooleanField(default=False, help_text='Secondary providers are displayed less prominently, in a separate list of "Institution" login providers.')), ('skip_registration_form', models.BooleanField(default=False, help_text='If this option is enabled, users will not be asked to confirm their details (name, email, etc.) during the registration process. Only select this option for trusted providers that are known to provide accurate user information.')), ('skip_email_verification', models.BooleanField(default=False, help_text='If this option is selected, users will not be required to confirm their email, and their account will be activated immediately upon registration.')), - ('backend_name', models.CharField(default=u'tpa-saml', help_text=u"Which python-social-auth provider backend to use. 'tpa-saml' is the standard edX SAML backend.", max_length=50)), - ('idp_slug', models.SlugField(help_text=u'A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30)), - ('entity_id', models.CharField(help_text=u'Example: https://idp.testshib.org/idp/shibboleth', max_length=255, verbose_name=u'Entity ID')), - ('metadata_source', models.CharField(help_text=u"URL to this provider's XML metadata. Should be an HTTPS URL. Example: https://www.testshib.org/metadata/testshib-providers.xml", max_length=255)), - ('attr_user_permanent_id', models.CharField(help_text=u'URN of the SAML attribute that we can use as a unique, persistent user ID. Leave blank for default.', max_length=128, verbose_name=u'User ID Attribute', blank=True)), - ('attr_full_name', models.CharField(help_text=u"URN of SAML attribute containing the user's full name. Leave blank for default.", max_length=128, verbose_name=u'Full Name Attribute', blank=True)), - ('attr_first_name', models.CharField(help_text=u"URN of SAML attribute containing the user's first name. Leave blank for default.", max_length=128, verbose_name=u'First Name Attribute', blank=True)), - ('attr_last_name', models.CharField(help_text=u"URN of SAML attribute containing the user's last name. Leave blank for default.", max_length=128, verbose_name=u'Last Name Attribute', blank=True)), - ('attr_username', models.CharField(help_text=u'URN of SAML attribute to use as a suggested username for this user. Leave blank for default.', max_length=128, verbose_name=u'Username Hint Attribute', blank=True)), - ('attr_email', models.CharField(help_text=u"URN of SAML attribute containing the user's email address[es]. Leave blank for default.", max_length=128, verbose_name=u'Email Attribute', blank=True)), - ('other_settings', models.TextField(help_text=u'For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports only {"requiredEntitlements": ["urn:..."]} which can be used to require the presence of a specific eduPersonEntitlement.', verbose_name=u'Advanced settings', blank=True)), + ('backend_name', models.CharField(default='tpa-saml', help_text="Which python-social-auth provider backend to use. 'tpa-saml' is the standard edX SAML backend.", max_length=50)), + ('idp_slug', models.SlugField(help_text='A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30)), + ('entity_id', models.CharField(help_text='Example: https://idp.testshib.org/idp/shibboleth', max_length=255, verbose_name='Entity ID')), + ('metadata_source', models.CharField(help_text="URL to this provider's XML metadata. Should be an HTTPS URL. Example: https://www.testshib.org/metadata/testshib-providers.xml", max_length=255)), + ('attr_user_permanent_id', models.CharField(help_text='URN of the SAML attribute that we can use as a unique, persistent user ID. Leave blank for default.', max_length=128, verbose_name='User ID Attribute', blank=True)), + ('attr_full_name', models.CharField(help_text="URN of SAML attribute containing the user's full name. Leave blank for default.", max_length=128, verbose_name='Full Name Attribute', blank=True)), + ('attr_first_name', models.CharField(help_text="URN of SAML attribute containing the user's first name. Leave blank for default.", max_length=128, verbose_name='First Name Attribute', blank=True)), + ('attr_last_name', models.CharField(help_text="URN of SAML attribute containing the user's last name. Leave blank for default.", max_length=128, verbose_name='Last Name Attribute', blank=True)), + ('attr_username', models.CharField(help_text='URN of SAML attribute to use as a suggested username for this user. Leave blank for default.', max_length=128, verbose_name='Username Hint Attribute', blank=True)), + ('attr_email', models.CharField(help_text="URN of SAML attribute containing the user's email address[es]. Leave blank for default.", max_length=128, verbose_name='Email Attribute', blank=True)), + ('other_settings', models.TextField(help_text='For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports only {"requiredEntitlements": ["urn:..."]} which can be used to require the presence of a specific eduPersonEntitlement.', verbose_name='Advanced settings', blank=True)), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], options={ @@ -112,7 +109,7 @@ class Migration(migrations.Migration): ('fetched_at', models.DateTimeField(db_index=True)), ('expires_at', models.DateTimeField(null=True, db_index=True)), ('entity_id', models.CharField(max_length=255, db_index=True)), - ('sso_url', models.URLField(verbose_name=u'SSO URL')), + ('sso_url', models.URLField(verbose_name='SSO URL')), ('public_key', models.TextField()), ], options={ diff --git a/common/djangoapps/third_party_auth/migrations/0002_schema__provider_icon_image.py b/common/djangoapps/third_party_auth/migrations/0002_schema__provider_icon_image.py index ebba1d5f48..26031b8302 100644 --- a/common/djangoapps/third_party_auth/migrations/0002_schema__provider_icon_image.py +++ b/common/djangoapps/third_party_auth/migrations/0002_schema__provider_icon_image.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,31 +11,31 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ltiproviderconfig', name='icon_image', - field=models.FileField(help_text=u'If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to=u'', blank=True), + field=models.FileField(help_text='If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to='', blank=True), ), migrations.AddField( model_name='oauth2providerconfig', name='icon_image', - field=models.FileField(help_text=u'If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to=u'', blank=True), + field=models.FileField(help_text='If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to='', blank=True), ), migrations.AddField( model_name='samlproviderconfig', name='icon_image', - field=models.FileField(help_text=u'If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to=u'', blank=True), + field=models.FileField(help_text='If there is no Font Awesome icon available for this provider, upload a custom image. SVG images are recommended as they can scale to any size.', upload_to='', blank=True), ), migrations.AlterField( model_name='ltiproviderconfig', name='icon_class', - field=models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), + field=models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), ), migrations.AlterField( model_name='oauth2providerconfig', name='icon_class', - field=models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), + field=models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), ), migrations.AlterField( model_name='samlproviderconfig', name='icon_class', - field=models.CharField(default=u'fa-sign-in', help_text=u'The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), + field=models.CharField(default='fa-sign-in', help_text='The Font Awesome (or custom) icon class to use on the login button for this provider. Examples: fa-google-plus, fa-facebook, fa-linkedin, fa-sign-in, fa-university', max_length=50, blank=True), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0003_samlproviderconfig_debug_mode.py b/common/djangoapps/third_party_auth/migrations/0003_samlproviderconfig_debug_mode.py index 6bf63df1b7..d63c35cb9c 100644 --- a/common/djangoapps/third_party_auth/migrations/0003_samlproviderconfig_debug_mode.py +++ b/common/djangoapps/third_party_auth/migrations/0003_samlproviderconfig_debug_mode.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,6 +11,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='samlproviderconfig', name='debug_mode', - field=models.BooleanField(default=False, help_text=u'In debug mode, all SAML XML requests and responses will be logged. This is helpful for testing/setup but should always be disabled before users start using this provider.', verbose_name=u'Debug Mode'), + field=models.BooleanField(default=False, help_text='In debug mode, all SAML XML requests and responses will be logged. This is helpful for testing/setup but should always be disabled before users start using this provider.', verbose_name='Debug Mode'), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0004_add_visible_field.py b/common/djangoapps/third_party_auth/migrations/0004_add_visible_field.py index f0e33046a8..32187da9da 100644 --- a/common/djangoapps/third_party_auth/migrations/0004_add_visible_field.py +++ b/common/djangoapps/third_party_auth/migrations/0004_add_visible_field.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -17,7 +14,7 @@ class Migration(migrations.Migration): model_name='LTIProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=True ), preserve_default=False @@ -26,7 +23,7 @@ class Migration(migrations.Migration): model_name='LTIProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=False ) ), @@ -34,7 +31,7 @@ class Migration(migrations.Migration): model_name='OAuth2ProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=True ), preserve_default=False @@ -43,7 +40,7 @@ class Migration(migrations.Migration): model_name='OAuth2ProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=False ) ), @@ -51,7 +48,7 @@ class Migration(migrations.Migration): model_name='SAMLProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=True ), preserve_default=False @@ -60,7 +57,7 @@ class Migration(migrations.Migration): model_name='SAMLProviderConfig', name='visible', field=models.BooleanField( - help_text=u'If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', + help_text='If this option is not selected, users will not be presented with the provider as an option to authenticate with on the login screen, but manual authentication using the correct link is still possible.', default=False ) ), diff --git a/common/djangoapps/third_party_auth/migrations/0005_add_site_field.py b/common/djangoapps/third_party_auth/migrations/0005_add_site_field.py index 6769985545..114078e3d2 100644 --- a/common/djangoapps/third_party_auth/migrations/0005_add_site_field.py +++ b/common/djangoapps/third_party_auth/migrations/0005_add_site_field.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.conf import settings from django.db import migrations, models @@ -28,7 +25,7 @@ class Migration(migrations.Migration): name='provider_slug', field=models.SlugField( default='temp', - help_text=u'A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', + help_text='A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30 ), preserve_default=False, diff --git a/common/djangoapps/third_party_auth/migrations/0006_samlproviderconfig_automatic_refresh_enabled.py b/common/djangoapps/third_party_auth/migrations/0006_samlproviderconfig_automatic_refresh_enabled.py index 4fc4162190..0d113a2966 100644 --- a/common/djangoapps/third_party_auth/migrations/0006_samlproviderconfig_automatic_refresh_enabled.py +++ b/common/djangoapps/third_party_auth/migrations/0006_samlproviderconfig_automatic_refresh_enabled.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,6 +11,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='samlproviderconfig', name='automatic_refresh_enabled', - field=models.BooleanField(default=True, help_text=u"When checked, the SAML provider's metadata will be included in the automatic refresh job, if configured.", verbose_name=u'Enable automatic metadata refresh'), + field=models.BooleanField(default=True, help_text="When checked, the SAML provider's metadata will be included in the automatic refresh job, if configured.", verbose_name='Enable automatic metadata refresh'), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0007_auto_20170406_0912.py b/common/djangoapps/third_party_auth/migrations/0007_auto_20170406_0912.py index 7c40df3209..808ed5c860 100644 --- a/common/djangoapps/third_party_auth/migrations/0007_auto_20170406_0912.py +++ b/common/djangoapps/third_party_auth/migrations/0007_auto_20170406_0912.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,11 +11,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='samlproviderconfig', name='identity_provider_type', - field=models.CharField(default=u'standard_saml_provider', help_text=u'Some SAML providers require special behavior. For example, SAP SuccessFactors SAML providers require an additional API call to retrieve user metadata not provided in the SAML response. Select the provider type which best matches your use case. If in doubt, choose the Standard SAML Provider type.', max_length=128, verbose_name=u'Identity Provider Type', choices=[(u'standard_saml_provider', u'Standard SAML provider'), (u'sap_success_factors', u'SAP SuccessFactors provider')]), + field=models.CharField(default='standard_saml_provider', help_text='Some SAML providers require special behavior. For example, SAP SuccessFactors SAML providers require an additional API call to retrieve user metadata not provided in the SAML response. Select the provider type which best matches your use case. If in doubt, choose the Standard SAML Provider type.', max_length=128, verbose_name='Identity Provider Type', choices=[('standard_saml_provider', 'Standard SAML provider'), ('sap_success_factors', 'SAP SuccessFactors provider')]), ), migrations.AlterField( model_name='samlproviderconfig', name='other_settings', - field=models.TextField(help_text=u'For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports only {"requiredEntitlements": ["urn:..."]} which can be used to require the presence of a specific eduPersonEntitlement. Custom provider types, as selected in the "Identity Provider Type" field, may make use of the information stored in this field for configuration.', verbose_name=u'Advanced settings', blank=True), + field=models.TextField(help_text='For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports only {"requiredEntitlements": ["urn:..."]} which can be used to require the presence of a specific eduPersonEntitlement. Custom provider types, as selected in the "Identity Provider Type" field, may make use of the information stored in this field for configuration.', verbose_name='Advanced settings', blank=True), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0008_auto_20170413_1455.py b/common/djangoapps/third_party_auth/migrations/0008_auto_20170413_1455.py index c87311006e..b4916d62d5 100644 --- a/common/djangoapps/third_party_auth/migrations/0008_auto_20170413_1455.py +++ b/common/djangoapps/third_party_auth/migrations/0008_auto_20170413_1455.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0009_auto_20170415_1144.py b/common/djangoapps/third_party_auth/migrations/0009_auto_20170415_1144.py index 17199777e6..c8d1ec76c2 100644 --- a/common/djangoapps/third_party_auth/migrations/0009_auto_20170415_1144.py +++ b/common/djangoapps/third_party_auth/migrations/0009_auto_20170415_1144.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,16 +11,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ltiproviderconfig', name='max_session_length', - field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name=u'Max session length (seconds)', blank=True), + field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name='Max session length (seconds)', blank=True), ), migrations.AddField( model_name='oauth2providerconfig', name='max_session_length', - field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name=u'Max session length (seconds)', blank=True), + field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name='Max session length (seconds)', blank=True), ), migrations.AddField( model_name='samlproviderconfig', name='max_session_length', - field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name=u'Max session length (seconds)', blank=True), + field=models.PositiveIntegerField(default=None, help_text='If this option is set, then users logging in using this SSO provider will have their session length limited to no longer than this value. If set to 0 (zero), the session will expire upon the user closing their browser. If left blank, the Django platform session default length will be used.', null=True, verbose_name='Max session length (seconds)', blank=True), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0010_add_skip_hinted_login_dialog_field.py b/common/djangoapps/third_party_auth/migrations/0010_add_skip_hinted_login_dialog_field.py index a743b09864..cef2143842 100644 --- a/common/djangoapps/third_party_auth/migrations/0010_add_skip_hinted_login_dialog_field.py +++ b/common/djangoapps/third_party_auth/migrations/0010_add_skip_hinted_login_dialog_field.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0011_auto_20170616_0112.py b/common/djangoapps/third_party_auth/migrations/0011_auto_20170616_0112.py index 06b6228bcb..3300a7f053 100644 --- a/common/djangoapps/third_party_auth/migrations/0011_auto_20170616_0112.py +++ b/common/djangoapps/third_party_auth/migrations/0011_auto_20170616_0112.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,6 +11,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='samlproviderconfig', name='other_settings', - field=models.TextField(help_text=u'For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports {"requiredEntitlements": ["urn:..."]}, which can be used to require the presence of a specific eduPersonEntitlement, and {"extra_field_definitions": [{"name": "...", "urn": "..."},...]}, which can be used to define registration form fields and the URNs that can be used to retrieve the relevant values from the SAML response. Custom provider types, as selected in the "Identity Provider Type" field, may make use of the information stored in this field for additional configuration.', verbose_name=u'Advanced settings', blank=True), + field=models.TextField(help_text='For advanced use cases, enter a JSON object with addtional configuration. The tpa-saml backend supports {"requiredEntitlements": ["urn:..."]}, which can be used to require the presence of a specific eduPersonEntitlement, and {"extra_field_definitions": [{"name": "...", "urn": "..."},...]}, which can be used to define registration form fields and the URNs that can be used to retrieve the relevant values from the SAML response. Custom provider types, as selected in the "Identity Provider Type" field, may make use of the information stored in this field for additional configuration.', verbose_name='Advanced settings', blank=True), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0012_auto_20170626_1135.py b/common/djangoapps/third_party_auth/migrations/0012_auto_20170626_1135.py index 54ffbf471d..60d38c2e83 100644 --- a/common/djangoapps/third_party_auth/migrations/0012_auto_20170626_1135.py +++ b/common/djangoapps/third_party_auth/migrations/0012_auto_20170626_1135.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0013_sync_learner_profile_data.py b/common/djangoapps/third_party_auth/migrations/0013_sync_learner_profile_data.py index 69114da8e7..339ec49562 100644 --- a/common/djangoapps/third_party_auth/migrations/0013_sync_learner_profile_data.py +++ b/common/djangoapps/third_party_auth/migrations/0013_sync_learner_profile_data.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0014_auto_20171222_1233.py b/common/djangoapps/third_party_auth/migrations/0014_auto_20171222_1233.py index 5012470c86..3dceaaf375 100644 --- a/common/djangoapps/third_party_auth/migrations/0014_auto_20171222_1233.py +++ b/common/djangoapps/third_party_auth/migrations/0014_auto_20171222_1233.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0015_samlproviderconfig_archived.py b/common/djangoapps/third_party_auth/migrations/0015_samlproviderconfig_archived.py index 04be00ff6e..558294db11 100644 --- a/common/djangoapps/third_party_auth/migrations/0015_samlproviderconfig_archived.py +++ b/common/djangoapps/third_party_auth/migrations/0015_samlproviderconfig_archived.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0016_auto_20180130_0938.py b/common/djangoapps/third_party_auth/migrations/0016_auto_20180130_0938.py index 3dfd854729..42bde81127 100644 --- a/common/djangoapps/third_party_auth/migrations/0016_auto_20180130_0938.py +++ b/common/djangoapps/third_party_auth/migrations/0016_auto_20180130_0938.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - import django.db.models.deletion from django.db import migrations, models @@ -15,7 +12,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='samlconfiguration', name='slug', - field=models.SlugField(default=u'default', help_text=u'A short string uniquely identifying this configuration. Cannot contain spaces. Examples: "ubc", "mit-staging"', max_length=30), + field=models.SlugField(default='default', help_text='A short string uniquely identifying this configuration. Cannot contain spaces. Examples: "ubc", "mit-staging"', max_length=30), ), migrations.AddField( model_name='samlproviderconfig', diff --git a/common/djangoapps/third_party_auth/migrations/0017_remove_icon_class_image_secondary_fields.py b/common/djangoapps/third_party_auth/migrations/0017_remove_icon_class_image_secondary_fields.py index 830fdcd257..65f2511a15 100644 --- a/common/djangoapps/third_party_auth/migrations/0017_remove_icon_class_image_secondary_fields.py +++ b/common/djangoapps/third_party_auth/migrations/0017_remove_icon_class_image_secondary_fields.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2018-01-30 17:38 diff --git a/common/djangoapps/third_party_auth/migrations/0018_auto_20180327_1631.py b/common/djangoapps/third_party_auth/migrations/0018_auto_20180327_1631.py index c8577e36ae..14d2bc3de3 100644 --- a/common/djangoapps/third_party_auth/migrations/0018_auto_20180327_1631.py +++ b/common/djangoapps/third_party_auth/migrations/0018_auto_20180327_1631.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/common/djangoapps/third_party_auth/migrations/0019_consolidate_slug.py b/common/djangoapps/third_party_auth/migrations/0019_consolidate_slug.py index 8db0edf7e0..585f8cb0b0 100644 --- a/common/djangoapps/third_party_auth/migrations/0019_consolidate_slug.py +++ b/common/djangoapps/third_party_auth/migrations/0019_consolidate_slug.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Custom migration script to add slug field to all ProviderConfig models. """ @@ -39,17 +38,17 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ltiproviderconfig', name='slug', - field=models.SlugField(default=u'default', help_text=u'A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), + field=models.SlugField(default='default', help_text='A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), ), migrations.AddField( model_name='oauth2providerconfig', name='slug', - field=models.SlugField(default=u'default', help_text=u'A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), + field=models.SlugField(default='default', help_text='A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), ), migrations.AddField( model_name='samlproviderconfig', name='slug', - field=models.SlugField(default=u'default', help_text=u'A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), + field=models.SlugField(default='default', help_text='A short string uniquely identifying this provider. Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"', max_length=30), ), migrations.RunPython(fill_slug_field, reverse_code=migrations.RunPython.noop), ] diff --git a/common/djangoapps/third_party_auth/migrations/0020_cleanup_slug_fields.py b/common/djangoapps/third_party_auth/migrations/0020_cleanup_slug_fields.py index e11c41c2ca..cdf64d5799 100644 --- a/common/djangoapps/third_party_auth/migrations/0020_cleanup_slug_fields.py +++ b/common/djangoapps/third_party_auth/migrations/0020_cleanup_slug_fields.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-04-10 13:57 diff --git a/common/djangoapps/third_party_auth/migrations/0021_sso_id_verification.py b/common/djangoapps/third_party_auth/migrations/0021_sso_id_verification.py index dc0d64215d..e65ae7d25e 100644 --- a/common/djangoapps/third_party_auth/migrations/0021_sso_id_verification.py +++ b/common/djangoapps/third_party_auth/migrations/0021_sso_id_verification.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-04-11 15:33 @@ -15,16 +14,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ltiproviderconfig', name='enable_sso_id_verification', - field=models.BooleanField(default=False, help_text=u'Use the presence of a profile from a trusted third party as proof of identity verification.'), + field=models.BooleanField(default=False, help_text='Use the presence of a profile from a trusted third party as proof of identity verification.'), ), migrations.AddField( model_name='oauth2providerconfig', name='enable_sso_id_verification', - field=models.BooleanField(default=False, help_text=u'Use the presence of a profile from a trusted third party as proof of identity verification.'), + field=models.BooleanField(default=False, help_text='Use the presence of a profile from a trusted third party as proof of identity verification.'), ), migrations.AddField( model_name='samlproviderconfig', name='enable_sso_id_verification', - field=models.BooleanField(default=False, help_text=u'Use the presence of a profile from a trusted third party as proof of identity verification.'), + field=models.BooleanField(default=False, help_text='Use the presence of a profile from a trusted third party as proof of identity verification.'), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0022_auto_20181012_0307.py b/common/djangoapps/third_party_auth/migrations/0022_auto_20181012_0307.py index 03baff9843..9053fc9a41 100644 --- a/common/djangoapps/third_party_auth/migrations/0022_auto_20181012_0307.py +++ b/common/djangoapps/third_party_auth/migrations/0022_auto_20181012_0307.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-10-12 07:07 @@ -15,26 +14,26 @@ class Migration(migrations.Migration): migrations.AddField( model_name='samlproviderconfig', name='default_email', - field=models.CharField(blank=True, help_text=u'Default value for email to be used if not present in SAML response.', max_length=255, verbose_name=u'Default Value for Email'), + field=models.CharField(blank=True, help_text='Default value for email to be used if not present in SAML response.', max_length=255, verbose_name='Default Value for Email'), ), migrations.AddField( model_name='samlproviderconfig', name='default_first_name', - field=models.CharField(blank=True, help_text=u'Default value for first name to be used if not present in SAML response.', max_length=255, verbose_name=u'Default Value for First Name'), + field=models.CharField(blank=True, help_text='Default value for first name to be used if not present in SAML response.', max_length=255, verbose_name='Default Value for First Name'), ), migrations.AddField( model_name='samlproviderconfig', name='default_full_name', - field=models.CharField(blank=True, help_text=u'Default value for full name to be used if not present in SAML response.', max_length=255, verbose_name=u'Default Value for Full Name'), + field=models.CharField(blank=True, help_text='Default value for full name to be used if not present in SAML response.', max_length=255, verbose_name='Default Value for Full Name'), ), migrations.AddField( model_name='samlproviderconfig', name='default_last_name', - field=models.CharField(blank=True, help_text=u'Default value for last name to be used if not present in SAML response.', max_length=255, verbose_name=u'Default Value for Last Name'), + field=models.CharField(blank=True, help_text='Default value for last name to be used if not present in SAML response.', max_length=255, verbose_name='Default Value for Last Name'), ), migrations.AddField( model_name='samlproviderconfig', name='default_username', - field=models.CharField(blank=True, help_text=u'Default value for username to be used if not present in SAML response.', max_length=255, verbose_name=u'Default Value for Username'), + field=models.CharField(blank=True, help_text='Default value for username to be used if not present in SAML response.', max_length=255, verbose_name='Default Value for Username'), ), ] diff --git a/common/djangoapps/third_party_auth/migrations/0023_auto_20190418_2033.py b/common/djangoapps/third_party_auth/migrations/0023_auto_20190418_2033.py index 3a3e66c0e6..6b17e7c6ea 100644 --- a/common/djangoapps/third_party_auth/migrations/0023_auto_20190418_2033.py +++ b/common/djangoapps/third_party_auth/migrations/0023_auto_20190418_2033.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-18 20:33 diff --git a/common/djangoapps/third_party_auth/migrations/0024_fix_edit_disallowed.py b/common/djangoapps/third_party_auth/migrations/0024_fix_edit_disallowed.py index 71d0fe50ac..4359ab1f68 100644 --- a/common/djangoapps/third_party_auth/migrations/0024_fix_edit_disallowed.py +++ b/common/djangoapps/third_party_auth/migrations/0024_fix_edit_disallowed.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-20 20:13 diff --git a/common/djangoapps/third_party_auth/migrations/0025_auto_20200303_1448.py b/common/djangoapps/third_party_auth/migrations/0025_auto_20200303_1448.py index 064216a5e4..9b57cbab45 100644 --- a/common/djangoapps/third_party_auth/migrations/0025_auto_20200303_1448.py +++ b/common/djangoapps/third_party_auth/migrations/0025_auto_20200303_1448.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-03 14:48 diff --git a/common/djangoapps/third_party_auth/tests/test_views.py b/common/djangoapps/third_party_auth/tests/test_views.py index 44fe56a492..932d77fe0f 100644 --- a/common/djangoapps/third_party_auth/tests/test_views.py +++ b/common/djangoapps/third_party_auth/tests/test_views.py @@ -4,9 +4,9 @@ Test the views served by third_party_auth. import unittest -import pytest import ddt +import pytest from django.conf import settings from django.urls import reverse from lxml import etree