mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 06:46:16 +00:00
Add basic do-almost-nothing Brotli endpoint test
This commit is contained in:
+9
-5
@@ -236,6 +236,10 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
response = self.app.get('/gzip')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_brotli(self):
|
||||
response = self.app.get('/brotli')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_digest_auth_with_wrong_password(self):
|
||||
auth_header = 'Digest username="user",realm="wrong",nonce="wrong",uri="/digest-auth/user/passwd/MD5",response="wrong",opaque="wrong"'
|
||||
response = self.app.get(
|
||||
@@ -488,7 +492,7 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
self.assertEqual(response.headers.get('ETag'), 'range1000')
|
||||
self.assertEqual(self.get_data(response), 'abcdefghijklmnop'.encode('utf8'))
|
||||
self.assertEqual(response.headers.get('Content-range'), 'bytes 0-15/1000')
|
||||
|
||||
|
||||
def test_request_range_open_ended_last_6_bytes(self):
|
||||
response = self.app.get(
|
||||
'/range/26',
|
||||
@@ -499,7 +503,7 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
self.assertEqual(response.headers.get('ETag'), 'range26')
|
||||
self.assertEqual(self.get_data(response), 'uvwxyz'.encode('utf8'))
|
||||
self.assertEqual(response.headers.get('Content-range'), 'bytes 20-25/26')
|
||||
|
||||
|
||||
def test_request_range_suffix(self):
|
||||
response = self.app.get(
|
||||
'/range/26',
|
||||
@@ -510,7 +514,7 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
self.assertEqual(response.headers.get('ETag'), 'range26')
|
||||
self.assertEqual(self.get_data(response), 'vwxyz'.encode('utf8'))
|
||||
self.assertEqual(response.headers.get('Content-range'), 'bytes 21-25/26')
|
||||
|
||||
|
||||
def test_request_out_of_bounds(self):
|
||||
response = self.app.get(
|
||||
'/range/26',
|
||||
@@ -522,13 +526,13 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
self.assertEqual(response.headers.get('ETag'), 'range26')
|
||||
self.assertEqual(len(self.get_data(response)), 0)
|
||||
self.assertEqual(response.headers.get('Content-range'), 'bytes */26')
|
||||
|
||||
|
||||
response = self.app.get(
|
||||
'/range/26',
|
||||
headers={ 'Range': 'bytes=32-40',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(response.status_code, 416)
|
||||
response = self.app.get(
|
||||
'/range/26',
|
||||
|
||||
Reference in New Issue
Block a user