Skip to content

Commit

Permalink
Temporarily comment out bad content length tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Mar 28, 2024
1 parent d253d2b commit b6e4037
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions tests/test_live_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,28 @@ def test_live_head(self, fmod_sl):
resp = self.head('/live/{0}httpbin.org/get?foo=bar', fmod_sl)
assert resp.status_int == 200

@pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
def test_live_bad_content_length(self, fmod_sl):
resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl, status=200)
assert resp.headers['Content-Length'] == '149'

resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl, status=200)
assert resp.headers['Content-Length'] == '90'

@pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
def test_live_bad_content_length_with_range(self, fmod_sl):
resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl,
headers={'Range': 'bytes=0-'}, status=206)
assert resp.headers['Content-Length'] == '149'
assert resp.headers['Content-Range'] == 'bytes 0-148/149'

resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl,
headers={'Range': 'bytes=0-'}, status=206)
assert resp.headers['Content-Length'] == '90'
assert resp.headers['Content-Range'] == 'bytes 0-89/90'
# Following tests are temporarily commented out because latest version of PSF httpbin
# now returns 400 if content-length header isn't parsable as an int

# @pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
# def test_live_bad_content_length(self, fmod_sl):
# resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl, status=200)
# assert resp.headers['Content-Length'] == '149'

# resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl, status=200)
# assert resp.headers['Content-Length'] == '90'

# @pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
# def test_live_bad_content_length_with_range(self, fmod_sl):
# resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl,
# headers={'Range': 'bytes=0-'}, status=206)
# assert resp.headers['Content-Length'] == '149'
# assert resp.headers['Content-Range'] == 'bytes 0-148/149'

# resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl,
# headers={'Range': 'bytes=0-'}, status=206)
# assert resp.headers['Content-Length'] == '90'
# assert resp.headers['Content-Range'] == 'bytes 0-89/90'

def test_custom_unicode_header(self, fmod_sl):
value = u'⛄'
Expand Down

0 comments on commit b6e4037

Please sign in to comment.