Ejemplo n.º 1
0
 def test_trim_spaces(self):
     parts = pymailcheck.split_email(" postbox@com")
     expected = {
         "address": "postbox",
         "domain": "com",
         "top_level_domain": "com",
         "second_level_domain": "",
     }
     self.assertEqual(parts, expected)
     parts = pymailcheck.split_email("postbox@com ")
     self.assertEqual(parts, expected)
Ejemplo n.º 2
0
 def test_contains_numbers(self):
     parts = pymailcheck.split_email("*****@*****.**")
     expected = {
         "address": "containsnumbers1234567890",
         "domain": "example.com",
         "top_level_domain": "com",
         "second_level_domain": "example",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 3
0
 def test_rfc_compliant(self):
     parts = pymailcheck.split_email('"foo@bar"@example.com')
     expected = {
         "address": '"foo@bar"',
         "domain": "example.com",
         "top_level_domain": "com",
         "second_level_domain": "example",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 4
0
 def test_four_level_domain(self):
     parts = pymailcheck.split_email("*****@*****.**")
     expected = {
         "address": "test",
         "domain": "mail.randomsmallcompany.co.uk",
         "top_level_domain": "randomsmallcompany.co.uk",
         "second_level_domain": "mail",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 5
0
 def test_three_level_domain(self):
     parts = pymailcheck.split_email("*****@*****.**")
     expected = {
         "address": "test",
         "domain": "example.co.uk",
         "top_level_domain": "co.uk",
         "second_level_domain": "example",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 6
0
 def test_contains_all_symbols(self):
     parts = pymailcheck.split_email('"()<>[]:;@,\\\"!#$%&\'*+-/=?^_`{}|\ \ \ \ \ ~\ \ \ \ \ \ \ ?\ \ \ \ \ \ \ \ \ \ \ \ ^_`{}|~.a"@allthesymbols.com')
     expected = {
         "address": '"()<>[]:;@,\\\"!#$%&\'*+-/=?^_`{}|\ \ \ \ \ ~\ \ \ \ \ \ \ ?\ \ \ \ \ \ \ \ \ \ \ \ ^_`{}|~.a"',
         "domain": "allthesymbols.com",
         "top_level_domain": "com",
         "second_level_domain": "allthesymbols",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 7
0
 def test_contains_period_at_sign(self):
     parts = pymailcheck.split_email('"*****@*****.**"@example.com')
     expected = {
         "address": '"*****@*****.**"',
         "domain": "example.com",
         "top_level_domain": "com",
         "second_level_domain": "example",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 8
0
 def test_contains_periods(self):
     parts = pymailcheck.split_email("*****@*****.**")
     expected = {
         "address": "contains.symbol",
         "domain": "domain.contains.symbol",
         "top_level_domain": "contains.symbol",
         "second_level_domain": "domain",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 9
0
 def test_contains_hyphen(self):
     parts = pymailcheck.split_email("*****@*****.**")
     expected = {
         "address": "contains-symbol",
         "domain": "example.com",
         "top_level_domain": "com",
         "second_level_domain": "example",
     }
     self.assertEqual(parts, expected)
Ejemplo n.º 10
0
 def test_not_rfc_compliant(self):
     self.assertFalse(pymailcheck.split_email("example.com"))
     self.assertFalse(pymailcheck.split_email("abc.example.com"))
     self.assertFalse(pymailcheck.split_email("@example.com"))
     self.assertFalse(pymailcheck.split_email("test@"))