-
Notifications
You must be signed in to change notification settings - Fork 1
/
test1.py
38 lines (33 loc) · 1.05 KB
/
test1.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
import unittest
from program2 import send_email
from util import clean_string
class TestCase1(unittest.TestCase):
def test_case_1(self):
template_code = """
<html>
<body>
<h1>Hello, {{first_name}} {{last_name}}!</h1>
<p>Thank you for registering with {{company}}.</p>
</body>
</html>
"""
context_data = {
"first_name": "John",
"last_name": "Doe",
"company": "Techdome"
}
expected_output = """
<html>
<body>
<h1>Hello, John Doe!</h1>
<p>Thank you for registering with Techdome.</p>
</body>
</html>
"""
result = send_email(None, '[email protected]',
context_data, template_code, [])
self.assertEqual(clean_string(
result['rendered_html']), clean_string(expected_output))
print('Test Case 1 Passed')
if __name__ == '__main__':
unittest.main()