@pytest.mark.django_db
def test_verify_user_without_existing_email(trans_member):
 member = trans_member
 with pytest.raises(EmailAddress.DoesNotExist):
  EmailAddress.objects.get(user=member)
 member.email = 'member@this.test'
 accounts.utils.verify_user(member)
 EmailAddress.objects.get(user=member, email='member@this.test', primary=True, verified=True)
 assert (get_user_model().objects.get(pk=member.pk).email == '')

@ pytest . mark . django_db def test_verify_user_without_existing_email ( trans_member ) : member = trans_member with pytest . raises ( EmailAddress . DoesNotExist ) : EmailAddress . objects . get ( user = member ) member . email = 'member@this.test' accounts . utils . verify_user ( member ) EmailAddress . objects . get ( user = member , email = 'member@this.test' , primary = True , verified = True ) assert ( get_user_model ( ) . objects . get ( pk = member . pk ) . email == '' )
test verifying user using verify_user function .