-
Notifications
You must be signed in to change notification settings - Fork 1
/
test6.py
44 lines (39 loc) · 1.14 KB
/
test6.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
import unittest
from program2 import send_email
from util import clean_string
class TestCase6(unittest.TestCase):
def test_case_6(self):
template_code = """
<html>
<body>
<h1>Shopping List:</h1>
<ul>
{% for item in items %}
<li>{{item}}</li>
{% endfor %}
</ul>
</body>
</html>
"""
context_data = {
"items": ["Milk", "Bread", "Eggs"]
}
expected_output = """
<html>
<body>
<h1>Shopping List:</h1>
<ul>
<li>Milk</li>
<li>Bread</li>
<li>Eggs</li>
</ul>
</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 6 Passed')
if __name__ == '__main__':
unittest.main()