Example #1
0
 def _check_cache_control_headers(self, resp, etag, max_age, timestamp=1234567890.0):
     eq_(resp.headers['ETag'], etag)
     if timestamp is None:
         assert 'Last-modified' not in resp.headers
     else:
         eq_(resp.headers['Last-modified'], format_httpdate(timestamp))
     eq_(resp.headers['Cache-control'], 'max-age=%d public' % max_age)
Example #2
0
 def _check_cache_control_headers(self, resp, etag, max_age, timestamp=1234567890.0):
     eq_(resp.headers['ETag'], etag)
     if timestamp is None:
         assert 'Last-modified' not in resp.headers
     else:
         eq_(resp.headers['Last-modified'], format_httpdate(timestamp))
     eq_(resp.headers['Cache-control'], 'max-age=%d public' % max_age)
Example #3
0
 def _check_cache_control_headers(self,
                                  resp,
                                  etag,
                                  max_age,
                                  timestamp=1234567890.0):
     assert resp.headers["ETag"] == etag
     if timestamp is None:
         assert "Last-modified" not in resp.headers
     else:
         assert resp.headers["Last-modified"] == format_httpdate(timestamp)
     assert resp.headers[
         "Cache-control"] == "public, max-age=%d, s-maxage=%d" % (
             max_age,
             max_age,
         )
Example #4
0
 def _last_modified_set(self, date):
     if not date: return
     self._timestamp = timestamp(date)
     self.headers['Last-modified'] = format_httpdate(self._timestamp)
Example #5
0
 def _last_modified_set(self, date):
     if not date: return
     self._timestamp = timestamp(date)
     self.headers['Last-modified'] = format_httpdate(self._timestamp)
Example #6
0
 def test_format_invalid(self):
     with pytest.raises(AssertionError):
         format_httpdate("foobar")
Example #7
0
 def test_format_httpdate(self):
     assert (format_httpdate(datetime.fromtimestamp(1234567890)) ==
             "Fri, 13 Feb 2009 23:31:30 GMT")
     assert format_httpdate(1234567890) == "Fri, 13 Feb 2009 23:31:30 GMT"
Example #8
0
 def test_format_invalid(self):
     format_httpdate('foobar')
Example #9
0
 def test_format_httpdate(self):
     eq_(format_httpdate(datetime.fromtimestamp(1234567890)),
         'Fri, 13 Feb 2009 23:31:30 GMT')
     eq_(format_httpdate(1234567890),
         'Fri, 13 Feb 2009 23:31:30 GMT')
Example #10
0
 def test_format_invalid(self):
     format_httpdate('foobar')
Example #11
0
 def test_format_httpdate(self):
     eq_(format_httpdate(datetime.fromtimestamp(1234567890)),
         'Fri, 13 Feb 2009 23:31:30 GMT')
     eq_(format_httpdate(1234567890), 'Fri, 13 Feb 2009 23:31:30 GMT')