def test_blacklist_positive(self): 'Disallows blacklist item: mailinator.com.' with self.assertRaises(DomainBlacklistedError): domainlist_check(EmailAddress('*****@*****.**')) with self.assertRaises(DomainBlacklistedError): validate_email_or_fail( email_address='*****@*****.**', check_regex=False, use_blacklist=True) with self.assertRaises(DomainBlacklistedError): validate_email_or_fail( email_address='*****@*****.**', check_regex=True, use_blacklist=True) with self.assertLogs(): self.assertFalse(expr=validate_email( email_address='*****@*****.**', check_regex=False, use_blacklist=True, debug=True)) with self.assertLogs(): self.assertFalse(expr=validate_email( email_address='*****@*****.**', check_regex=True, use_blacklist=True, debug=True))
def test_blacklist_positive(self): 'Disallows blacklist item: mailinator.com.' domainlist_check._load_builtin_blacklist() self.assertFalse(expr=domainlist_check(user_part='pa2', domain_part='mailinator.com')) self.assertFalse( expr=validate_email(email_address='*****@*****.**', check_regex=False, use_blacklist=True)) self.assertFalse( expr=validate_email(email_address='*****@*****.**', check_regex=True, use_blacklist=True))
def test_blacklist_negative(self): 'Allows a domain not in the blacklist.' self.assertTrue(expr=domainlist_check( EmailAddress('*****@*****.**')))
def test_blacklist_negative(self): 'Allows a domain not in the blacklist.' self.assertTrue(expr=domainlist_check( user_part='pa2', domain_part='some-random-domain-thats-not-blacklisted.com'))