def test_retire_recovery_email(self): """ Assert that Account Record for a given user is deleted when `retire_recovery_email` is called """ # Create user and associated recovery email record user = UserFactory() AccountRecoveryFactory(user=user) assert len(AccountRecovery.objects.filter(user_id=user.id)) == 1 # Retire recovery email AccountRecovery.retire_recovery_email(user_id=user.id) # Assert that there is no longer an AccountRecovery record for this user assert len(AccountRecovery.objects.filter(user_id=user.id)) == 0
def setUp(self): super(UserAccountUpdateTest, self).setUp() # Create/activate a new account activation_key = create_account(self.USERNAME, self.OLD_PASSWORD, self.OLD_EMAIL) activate_account(activation_key) self.account_recovery = AccountRecoveryFactory.create(user=User.objects.get(email=self.OLD_EMAIL)) self.enable_account_recovery_switch = Switch.objects.create( name=ENABLE_SECONDARY_EMAIL_FEATURE_SWITCH, active=True ) # Login result = self.client.login(username=self.USERNAME, password=self.OLD_PASSWORD) self.assertTrue(result)