@@ 216,6 216,7 @@ class ViewTests(TestCase):
create_activity(grade=2)
r = self.get(url, p)
self.assert_response(r)
+ self.assertEqual('no-store' in r['Cache-Control'], True)
self.assertContains(r, "testtask")
if 'query' in p and "/task" not in url:
self.assertContains(r, "?query=" + p['query'])
@@ 373,9 374,15 @@ class ViewTests(TestCase):
response = self.post_activity()
self.assert_redirect(response, 'testnexturl')
+ def _test_static(self, url):
+ r = self.response_eq_200(url)
+ #print(r['Vary'])
+ self.assertEqual('max-age' in r['Cache-Control'], True)
+ self.assertEqual('Cookie' in r['Vary'], True) # static pages also have the login user name
+
def test_legal(self):
- self.response_eq_200(reverse("legal"))
-
+ self._test_static(reverse('legal'))
+
def test_new(self):
self.response_eq_200(reverse("new"))
# https://stackoverflow.com/questions/7123161/django-testing-static-files
@@ 387,10 394,10 @@ class ViewTests(TestCase):
self.assert_redirect(response, reverse("todo"))
def test_index(self):
- self.response_eq_200("/")
+ self._test_static("/")
def test_doc(self):
- self.response_eq_200(reverse('doc'))
+ self._test_static(reverse('doc'))
def test_descr(self):
- self.response_eq_200(reverse('descr'))
+ self._test_static(reverse('descr'))