Esempio n. 1
0
    def test_saving_and_retrieving_email(self):
        email = Email()
        email.address = '*****@*****.**'
        email.verified = False
        email.full_clean()
        email.save()

        email = Email.objects.first()
        self.assertEqual(email.address, '*****@*****.**')
        self.assertEqual(email.verified, False)
Esempio n. 2
0
    def test_email_verified_defaults_to_false(self):
        email = Email()
        email.address = '*****@*****.**'
        email.full_clean()
        email.save()

        email = Email.objects.first()
        self.assertEqual(email.address, '*****@*****.**')
        self.assertEqual(email.verified, False)
Esempio n. 3
0
def create_email_or_None(address):
    email = Email()
    email.address = address
    try:
        email.full_clean()
        email.save()
        return email
    except ValidationError:
        return None