49 'if-modified-since': req.get_response_header('last-modified', raw=True), |
49 'if-modified-since': req.get_response_header('last-modified', raw=True), |
50 } |
50 } |
51 with self._publish_static_files('data/cubicweb.css', next_headers) as req: |
51 with self._publish_static_files('data/cubicweb.css', next_headers) as req: |
52 self.assertEqual(304, req.status_out) |
52 self.assertEqual(304, req.status_out) |
53 |
53 |
|
54 class StaticDirectoryControllerTC(staticfilespublishermixin, CubicWebTC): |
54 |
55 |
|
56 def test_check_static_dir_access(self): |
|
57 """write a file in the static directory and test the access""" |
|
58 staticdir = osp.join(self.session.vreg.config.static_directory) |
|
59 if not os.path.exists(staticdir): |
|
60 os.makedirs(staticdir) |
|
61 filename = osp.join(staticdir, 'test') |
|
62 with open(filename, 'a') as f: |
|
63 with self._publish_static_files('static/test') as req: |
|
64 self.assertEqual(200, req.status_out) |
55 |
65 |
56 class DataControllerTC(staticfilespublishermixin, CubicWebTC): |
66 class DataControllerTC(staticfilespublishermixin, CubicWebTC): |
57 tags = CubicWebTC.tags | Tags('static_controller', 'data', 'http') |
67 tags = CubicWebTC.tags | Tags('static_controller', 'data', 'http') |
58 |
68 |
59 def _check_datafile_ok(self, fname): |
69 def _check_datafile_ok(self, fname): |