def test_rejects_address_with_incorrect_domain(self): with patch.object(settings, 'GOOGLE_APPS_DOMAIN', 'example.com'): self.assertFalse(validate_email('*****@*****.**'))
def test_accepts_address_from_exception_list(self): with patch.multiple(settings, GOOGLE_APPS_DOMAIN='example.com', ALLOWED_EXTERNAL_USERS=['*****@*****.**']): self.assertTrue(validate_email('*****@*****.**'))
def test_accept_any_address_when_domain_empty(self): with patch.object(settings, 'GOOGLE_APPS_DOMAIN', None): self.assertTrue(validate_email('*****@*****.**'))
def test_accepts_address_with_correct_domain(self): with patch.object(settings, 'GOOGLE_APPS_DOMAIN', 'example.com'): self.assertTrue(validate_email('*****@*****.**'))