Skip to content

Commit c852f43

Browse files
wizpig64auvipy
authored andcommitted
added test for {% cache %} with a None timeout
1 parent ea27f81 commit c852f43

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/testapp/tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ def test_cache_01(self):
216216

217217
self.assertEqual(result, "fóäo bar")
218218

219+
def test_cache_none(self):
220+
template_content1 = "{% cache none 'barr' %}foo foo berry{% endcache %}"
221+
template_content2 = "{% cache none 'barr' %}not rendered{% endcache %}"
222+
223+
request = self.factory.get('/forgotten/flavor')
224+
context = RequestContext(request)
225+
226+
template1 = self.env.from_string(template_content1)
227+
result1 = template1.render(context)
228+
template2 = self.env.from_string(template_content2)
229+
result2 = template2.render(context)
230+
231+
self.assertEqual(result1, "foo foo berry")
232+
self.assertEqual(result2, "foo foo berry")
233+
219234
def test_404_page(self):
220235
response = self.client.get(reverse("page-404"))
221236
self.assertEqual(response.status_code, 404)

0 commit comments

Comments
 (0)