-
Notifications
You must be signed in to change notification settings - Fork 1
/
test2.py
37 lines (32 loc) · 1.03 KB
/
test2.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
import unittest
from program2 import send_email
from util import clean_string
class TestCase2(unittest.TestCase):
def test_case_2(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",
"company": "Techdome"
}
expected_output = """
<html>
<body>
<h1>Hello, John {{last_name}}!</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 2 Passed')
if __name__ == '__main__':
unittest.main()