forked from jmarkowski/secret-santa-mailer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-send-letters.py
executable file
·53 lines (31 loc) · 1.26 KB
/
test-send-letters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
import importlib
import unittest
sendletters = importlib.import_module('send-letters')
class EmailTests(unittest.TestCase):
def test_valid_basic(self):
email = '[email protected]'
self.assertTrue(sendletters.is_email_valid(email))
def test_valid_with_plus(self):
email = '[email protected]'
self.assertTrue(sendletters.is_email_valid(email))
def test_valid_complex(self):
email = '[email protected]'
self.assertTrue(sendletters.is_email_valid(email))
def test_valid_domain(self):
email = '[email protected]'
self.assertTrue(sendletters.is_email_valid(email))
def test_valid_tree_sufix(self):
email = '[email protected]'
self.assertTrue(sendletters.is_email_valid(email))
def test_invalid_basic(self):
email = 'invalidemail.com'
self.assertFalse(sendletters.is_email_valid(email))
def test_invalid_bad_chars(self):
email = 'invalid email [email protected]'
self.assertFalse(sendletters.is_email_valid(email))
def test_invalid_tld(self):
email = 'invalid-email@bad{}.com'
self.assertFalse(sendletters.is_email_valid(email))
if __name__ == '__main__':
unittest.main()