251 hout = [('etag', 'babar'), |
251 hout = [('etag', 'babar'), |
252 ] |
252 ] |
253 req = _test_cache(hin, hout, method='POST') |
253 req = _test_cache(hin, hout, method='POST') |
254 self.assertCache(412, req.status_out, 'not modifier HEAD verb') |
254 self.assertCache(412, req.status_out, 'not modifier HEAD verb') |
255 |
255 |
256 @tag('expires') |
|
257 def test_expires_added(self): |
|
258 #: Check that Expires header is added: |
|
259 #: - when the page is modified |
|
260 #: - when none was already present |
|
261 hin = [('if-none-match', 'babar'), |
|
262 ] |
|
263 hout = [('etag', 'rhino/really-not-babar'), |
|
264 ] |
|
265 req = _test_cache(hin, hout) |
|
266 self.assertCache(None, req.status_out, 'modifier HEAD verb') |
|
267 value = req.headers_out.getHeader('expires') |
|
268 self.assertIsNotNone(value) |
|
269 |
|
270 @tag('expires') |
|
271 def test_expires_not_added(self): |
|
272 #: Check that Expires header is not added if NOT-MODIFIED |
|
273 hin = [('if-none-match', 'babar'), |
|
274 ] |
|
275 hout = [('etag', 'babar'), |
|
276 ] |
|
277 req = _test_cache(hin, hout) |
|
278 self.assertCache(304, req.status_out, 'not modifier HEAD verb') |
|
279 value = req.headers_out.getHeader('expires') |
|
280 self.assertIsNone(value) |
|
281 |
|
282 @tag('expires') |
|
283 def test_expires_no_overwrite(self): |
|
284 #: Check that cache does not overwrite existing Expires header |
|
285 hin = [('if-none-match', 'babar'), |
|
286 ] |
|
287 DATE = 'Sat, 13 Apr 2012 14:39:32 GM' |
|
288 hout = [('etag', 'rhino/really-not-babar'), |
|
289 ('expires', DATE), |
|
290 ] |
|
291 req = _test_cache(hin, hout) |
|
292 self.assertCache(None, req.status_out, 'not modifier HEAD verb') |
|
293 value = req.headers_out.getRawHeaders('expires') |
|
294 self.assertEqual(value, [DATE]) |
|
295 |
|
296 |
256 |
297 alloworig = 'access-control-allow-origin' |
257 alloworig = 'access-control-allow-origin' |
298 allowmethods = 'access-control-allow-methods' |
258 allowmethods = 'access-control-allow-methods' |
299 allowheaders = 'access-control-allow-headers' |
259 allowheaders = 'access-control-allow-headers' |
300 allowcreds = 'access-control-allow-credentials' |
260 allowcreds = 'access-control-allow-credentials' |