Fix migrations, PR suggestions

This commit is contained in:
zandercymatics 2024-04-26 08:07:50 -06:00
parent 2fff3022ea
commit d9408076b1
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 10 additions and 7 deletions

View file

@ -241,7 +241,10 @@ class ViewsTest(TestCase):
@less_console_noise_decorator @less_console_noise_decorator
def test_login_callback_sets_verification_type_regular(self, mock_client): def test_login_callback_sets_verification_type_regular(self, mock_client):
"""Test that openid sets the verification type to regular on the returned user""" """
Test that openid sets the verification type to regular on the returned user.
Regular, in this context, means that this user was "Verifed by Login.gov"
"""
# SETUP # SETUP
session = self.client.session session = self.client.session
session.save() session.save()

View file

@ -93,7 +93,7 @@ class PopulateScriptTemplate(ABC):
self.populate_field(updated_object) self.populate_field(updated_object)
to_update.append(updated_object) to_update.append(updated_object)
except Exception as err: except Exception as err:
to_update.append(updated_object) failed_to_update.append(updated_object)
logger.error(err) logger.error(err)
logger.error(f"{TerminalColors.FAIL}" f"Failed to update {updated_object}" f"{TerminalColors.ENDC}") logger.error(f"{TerminalColors.FAIL}" f"Failed to update {updated_object}" f"{TerminalColors.ENDC}")

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.10 on 2024-04-23 20:47 # Generated by Django 4.2.10 on 2024-04-26 14:03
from django.db import migrations, models from django.db import migrations, models
@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("registrar", "0087_alter_domain_deleted_alter_domain_expiration_date_and_more"), ("registrar", "0088_domaininformation_cisa_representative_email_and_more"),
] ]
operations = [ operations = [

View file

@ -149,10 +149,10 @@ class User(AbstractUser):
# always exist at this point. We do it down the line. # always exist at this point. We do it down the line.
verification_type = cls.get_verification_type_from_email(email) verification_type = cls.get_verification_type_from_email(email)
# Checks if the user needs verification.
# The user needs identity verification if they don't meet # The user needs identity verification if they don't meet
# any special criteria, i.e. we are validating them "regularly" # any special criteria, i.e. we are validating them "regularly"
needs_verification = verification_type == cls.VerificationTypeChoices.REGULAR return verification_type == cls.VerificationTypeChoices.REGULAR
return needs_verification
def set_user_verification_type(self): def set_user_verification_type(self):
""" """
@ -174,7 +174,7 @@ class User(AbstractUser):
# If you joined BEFORE the oldest invitation was created, then you were verified normally. # If you joined BEFORE the oldest invitation was created, then you were verified normally.
# (See logic in get_verification_type_from_email) # (See logic in get_verification_type_from_email)
if invitation is not None and self.date_joined < invitation.created_at: if not invitation and self.date_joined < invitation.created_at:
verification_type = User.VerificationTypeChoices.REGULAR verification_type = User.VerificationTypeChoices.REGULAR
self.verification_type = verification_type self.verification_type = verification_type