Commits

Andriy Kornatskyy committed 10e8430

Improved functional tests for if modified since and if none match.

Comments (0)

Files changed (2)

demos/public/src/public/web/tests/benchmark_views.py

             self.test_static_files,
             self.test_static_file_not_found,
             self.test_static_file_forbidden,
-            self.test_static_file_if_modified_since,
-            self.test_static_file_if_none_match,
             self.test_static_file_gzip,
             self.test_head_static_file
             ), 1000)
                 'test_static_files': 1.655,
                 'test_static_file_not_found': 2.0,
                 'test_static_file_forbidden': 2.2,
-                'test_static_file_if_modified_since': 7.0,
-                'test_static_file_if_none_match': 11.3,
                 'test_static_file_gzip': 8.91,
                 'test_head_static_file': 9.08
         })

demos/public/src/public/web/tests/test_views.py

 except ImportError:
     json = None
 
+
 from wheezy.http.functional import WSGIClient
 
 from app import main
     def test_static_file_if_modified_since(self):
         """
         """
+        assert 200 == self.client.get('/static/css/site.css')
+        last_modified = self.client.headers['Last-Modified'][0]
         assert 304 == self.client.get('/static/css/site.css', environ={
-            'HTTP_IF_MODIFIED_SINCE': 'Fri, 24 Feb 2012 14:11:30 GMT'
+            'HTTP_IF_MODIFIED_SINCE': last_modified
         })
 
     def test_static_file_if_none_match(self):
         """
         """
+        assert 200 == self.client.get('/static/css/site.css')
+        etag = self.client.headers['ETag'][0]
         assert 304 == self.client.get('/static/css/site.css', environ={
-            'HTTP_IF_NONE_MATCH': '"4f479a92"'
+            'HTTP_IF_NONE_MATCH': etag
         })
 
     def test_head_static_file(self):