mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
squash 3xx tests into super tests
This commit is contained in:
@@ -225,31 +225,6 @@ class TestRequests:
|
||||
else:
|
||||
pytest.fail('Expected custom max number of redirects to be respected but was not')
|
||||
|
||||
def test_http_301_changes_post_to_get(self, httpbin):
|
||||
r = requests.post(httpbin('status', '301'))
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'GET'
|
||||
assert r.history[0].status_code == 301
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
def test_http_301_doesnt_change_head_to_get(self, httpbin):
|
||||
r = requests.head(httpbin('status', '301'), allow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'HEAD'
|
||||
assert r.history[0].status_code == 301
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
def test_http_301_doesnt_change_non_post_to_get(self, httpbin):
|
||||
r = requests.patch(httpbin('redirect-to'),
|
||||
data='test body',
|
||||
params={'url': 'patch', 'status_code': '301'})
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'PATCH'
|
||||
assert r.history[0].status_code == 301
|
||||
assert r.history[0].is_redirect
|
||||
assert r.request.body == 'test body'
|
||||
assert r.json()['data'] == 'test body'
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'method, body, expected', (
|
||||
('GET', None, 'GET'),
|
||||
@@ -280,20 +255,6 @@ class TestRequests:
|
||||
else:
|
||||
assert r.json()['data'] == body
|
||||
|
||||
def test_http_302_changes_post_to_get(self, httpbin):
|
||||
r = requests.post(httpbin('status', '302'))
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'GET'
|
||||
assert r.history[0].status_code == 302
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
def test_http_302_doesnt_change_head_to_get(self, httpbin):
|
||||
r = requests.head(httpbin('status', '302'), allow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'HEAD'
|
||||
assert r.history[0].status_code == 302
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'method, body, expected', (
|
||||
('GET', None, 'GET'),
|
||||
@@ -324,20 +285,6 @@ class TestRequests:
|
||||
else:
|
||||
assert r.json()['data'] == body
|
||||
|
||||
def test_http_303_changes_post_to_get(self, httpbin):
|
||||
r = requests.post(httpbin('status', '303'))
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'GET'
|
||||
assert r.history[0].status_code == 303
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
def test_http_303_doesnt_change_head_to_get(self, httpbin):
|
||||
r = requests.head(httpbin('status', '303'), allow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
assert r.request.method == 'HEAD'
|
||||
assert r.history[0].status_code == 303
|
||||
assert r.history[0].is_redirect
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'method, body, expected', (
|
||||
('GET', None, 'GET'),
|
||||
|
||||
Reference in New Issue
Block a user