コード例 #1
0
 def test_refresh(self):
     template = self.get_django_template("<h1>{% viewlet hello_cached_timestamp 'world' %}</h1>")
     html1 = self.render(template)
     sleep(0.01)
     viewlet.refresh('hello_cached_timestamp', 'world')
     html2 = self.render(template)
     self.assertNotEqual(html1, html2)
コード例 #2
0
 def test_refreshing_context_viewlet_expecting_request_while_rendering_using_jinja2(self):
     template = self.get_jinja_template("{% viewlet 'hello_request', 'nice to see you' %}")
     html = template.render({'request': {'user': '******'}})
     viewlet.refresh('hello_request', 'nice to see you')
     self.assertNotEqual(template.render({'request': {'user': '******'}}), html)