lint fixes

This commit is contained in:
Matt Hughes
2019-11-18 11:23:42 -05:00
committed by Matt Hughes
parent 66b970c11d
commit 1185d3dd9c
2 changed files with 12 additions and 10 deletions

View File

@@ -48,7 +48,7 @@ class Command(BaseCommand):
uid_mappings = json.load(f)
slug = options['saml_provider_slug']
email_map = { m['email']: {'uid': m['student_key'], 'updated': False, 'counted': False } for m in uid_mappings }
email_map = {m['email']: {'uid': m['student_key'], 'updated': False, 'counted': False} for m in uid_mappings}
user_queryset = User.objects.prefetch_related('social_auth').filter(social_auth__uid__startswith=slug + ':')
users = [u for u in user_queryset]
@@ -85,14 +85,16 @@ class Command(BaseCommand):
'Number of users with {slug} UserSocialAuth records for which there was no mapping in the provided file: {missed}'.format(
slug=slug,
missed=missed
))
)
)
log.info(
'Number of users identified in the mapping file without {slug} UserSocialAuth records: {not_previously_linked}'.format(
slug=slug,
not_previously_linked=not_previously_linked
))
log.info('Number of mappings in the mapping file where the identified user has already been processed: {duplicated_in_mapping}'.format(
duplicated_in_mapping=duplicated_in_mapping
))
)
)
log.info(
'Number of mappings in the mapping file where the identified user has already been processed: {duplicated_in_mapping}'.format(
duplicated_in_mapping=duplicated_in_mapping
)
)

View File

@@ -16,6 +16,7 @@ from student.tests.factories import UserFactory
_COMMAND_PATH = 'lms.djangoapps.program_enrollments.management.commands.migrate_saml_uids'
class UserSocialAuthFactory(DjangoModelFactory):
"""
Factory for UserSocialAuth records.
@@ -41,8 +42,7 @@ class TestMigrateSamlUids(TestCase):
cls.command = migrate_saml_uids.Command()
def _format_email_uid_pair(self, email, uid):
return '{{"email":"{email}","student_key":"{new_urn}"}}'.format(email=email, new_urn=uid)
return '{{"email":"{email}","student_key":"{new_urn}"}}'.format(email=email, new_urn=uid)
def _format_single_email_uid_pair_json(self, email, uid):
return '[{obj}]'.format(