[tests/mod_deflate] test removing Accept-Encoding header

personal/stbuehler/wip
Stefan Bühler 9 years ago
parent b9d77f50a4
commit c15b37260a
  1. 14
      tests/requests.py
  2. 12
      tests/t-deflate.py

@ -157,11 +157,15 @@ class CurlRequest(TestBase):
raise CurlRequestException("Unexpected response body")
for (k, v) in self.EXPECT_RESPONSE_HEADERS:
if not self.resp_headers.has_key(k.lower()):
raise CurlRequestException("Didn't get wanted response header '%s'" % (k))
v1 = self.resp_headers[k.lower()]
if v1 != v:
raise CurlRequestException("Unexpected response header '%s' = '%s' (wanted '%s')" % (k, v1, v))
if v == None:
if self.resp_headers.has_key(k.lower()):
raise CurlRequestException("Got unwanted response header '%s' = '%s'" % (k, self.resp_headers[k.lower()]))
else:
if not self.resp_headers.has_key(k.lower()):
raise CurlRequestException("Didn't get wanted response header '%s'" % (k))
v1 = self.resp_headers[k.lower()]
if v1 != v:
raise CurlRequestException("Unexpected response header '%s' = '%s' (wanted '%s')" % (k, v1, v))
return True

@ -39,10 +39,18 @@ class TestBzip2(DeflateRequest):
class TestXBzip2(DeflateRequest):
ACCEPT_ENCODING = 'x-bzip2'
class TestDisableDeflate(CurlRequest):
URL = "/test.txt?nodeflate"
EXPECT_RESPONSE_BODY = TEST_TXT
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Encoding", None)]
class Test(GroupTest):
group = [TestGzip, TestXGzip, TestDeflate, TestBzip2, TestXBzip2]
group = [TestGzip, TestXGzip, TestDeflate, TestBzip2, TestXBzip2, TestDisableDeflate]
def Prepare(self):
self.PrepareVHostFile("test.txt", TEST_TXT)
# deflate is enabled global too; force it here anyway
self.config = """static; do_deflate;"""
self.config = """if req.query == "nodeflate" { req_header.remove "Accept-Encoding"; } static; do_deflate;"""

Loading…
Cancel
Save