blob: 0439b09829a91288fefaeddee1e79cf2a2458da8 [file] [log] [blame]
From 720240501dca0b4eacc3295665d7ced8719e11d2 Mon Sep 17 00:00:00 2001
From: Quentin Pradet <quentin.pradet@gmail.com>
Date: Fri, 28 Apr 2023 23:28:43 +0400
Subject: [PATCH] Test urllib3 2.0
Upstream-Status: Submitted [https://github.com/requests/toolbelt/pull/356]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../redirect_request_for_dump_all.json | 302 +++++++++++++-----
tests/cassettes/simple_get_request.json | 16 +-
tox.ini | 11 +-
3 files changed, 239 insertions(+), 90 deletions(-)
diff --git a/tests/cassettes/redirect_request_for_dump_all.json b/tests/cassettes/redirect_request_for_dump_all.json
index f713ff3..dc8fefe 100644
--- a/tests/cassettes/redirect_request_for_dump_all.json
+++ b/tests/cassettes/redirect_request_for_dump_all.json
@@ -1,17 +1,25 @@
{
"http_interactions": [
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:50",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/redirect/5"
@@ -22,14 +30,30 @@
"string": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>Redirecting...</title>\n<h1>Redirecting...</h1>\n<p>You should be redirected automatically to target URL: <a href=\"/relative-redirect/4\">/relative-redirect/4</a>. If not click the link."
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "247",
- "Content-Type": "text/html; charset=utf-8",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Location": "/relative-redirect/4",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "247"
+ ],
+ "Content-Type": [
+ "text/html; charset=utf-8"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:50 GMT"
+ ],
+ "Location": [
+ "/relative-redirect/4"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 302,
@@ -39,17 +63,25 @@
}
},
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:52",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/relative-redirect/4"
@@ -60,14 +92,30 @@
"string": ""
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "0",
- "Content-Type": "text/html; charset=utf-8",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Location": "/relative-redirect/3",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "0"
+ ],
+ "Content-Type": [
+ "text/html; charset=utf-8"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:52 GMT"
+ ],
+ "Location": [
+ "/relative-redirect/3"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 302,
@@ -77,17 +125,25 @@
}
},
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:53",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/relative-redirect/3"
@@ -98,14 +154,30 @@
"string": ""
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "0",
- "Content-Type": "text/html; charset=utf-8",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Location": "/relative-redirect/2",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "0"
+ ],
+ "Content-Type": [
+ "text/html; charset=utf-8"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:53 GMT"
+ ],
+ "Location": [
+ "/relative-redirect/2"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 302,
@@ -115,17 +187,25 @@
}
},
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:55",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/relative-redirect/2"
@@ -136,14 +216,30 @@
"string": ""
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "0",
- "Content-Type": "text/html; charset=utf-8",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Location": "/relative-redirect/1",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "0"
+ ],
+ "Content-Type": [
+ "text/html; charset=utf-8"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:55 GMT"
+ ],
+ "Location": [
+ "/relative-redirect/1"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 302,
@@ -153,17 +249,25 @@
}
},
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:56",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/relative-redirect/1"
@@ -174,14 +278,30 @@
"string": ""
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "0",
- "Content-Type": "text/html; charset=utf-8",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Location": "/get",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "0"
+ ],
+ "Content-Type": [
+ "text/html; charset=utf-8"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:56 GMT"
+ ],
+ "Location": [
+ "/get"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 302,
@@ -191,34 +311,56 @@
}
},
{
- "recorded_at": "2015-11-14T22:53:20",
+ "recorded_at": "2023-04-28T18:04:58",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate",
- "Connection": "keep-alive",
- "User-Agent": "python-requests/2.8.1"
+ "Accept": [
+ "*/*"
+ ],
+ "Accept-Encoding": [
+ "gzip, deflate"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "User-Agent": [
+ "python-requests/2.28.1"
+ ]
},
"method": "GET",
"uri": "https://httpbin.org/get"
},
"response": {
"body": {
- "encoding": null,
- "string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"*/*\", \n \"Accept-Encoding\": \"gzip, deflate\", \n \"Host\": \"httpbin.org\", \n \"User-Agent\": \"python-requests/2.8.1\"\n }, \n \"origin\": \"<IPADDR>\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
+ "encoding": "utf-8",
+ "string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"*/*\", \n \"Accept-Encoding\": \"gzip, deflate\", \n \"Host\": \"httpbin.org\", \n \"User-Agent\": \"python-requests/2.28.1\", \n \"X-Amzn-Trace-Id\": \"Root=1-644c0ac8-450daa2735c478ca518c5c8d\"\n }, \n \"origin\": \"83.198.52.66\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
},
"headers": {
- "Access-Control-Allow-Credentials": "true",
- "Access-Control-Allow-Origin": "*",
- "Connection": "keep-alive",
- "Content-Length": "239",
- "Content-Type": "application/json",
- "Date": "Sat, 14 Nov 2015 22:53:18 GMT",
- "Server": "nginx"
+ "Access-Control-Allow-Credentials": [
+ "true"
+ ],
+ "Access-Control-Allow-Origin": [
+ "*"
+ ],
+ "Connection": [
+ "keep-alive"
+ ],
+ "Content-Length": [
+ "306"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Date": [
+ "Fri, 28 Apr 2023 18:04:58 GMT"
+ ],
+ "Server": [
+ "gunicorn/19.9.0"
+ ]
},
"status": {
"code": 200,
@@ -228,5 +370,5 @@
}
}
],
- "recorded_with": "betamax/0.5.1"
+ "recorded_with": "betamax/0.8.2"
}
\ No newline at end of file
diff --git a/tests/cassettes/simple_get_request.json b/tests/cassettes/simple_get_request.json
index 68378cd..a97bcf1 100644
--- a/tests/cassettes/simple_get_request.json
+++ b/tests/cassettes/simple_get_request.json
@@ -1,7 +1,7 @@
{
"http_interactions": [
{
- "recorded_at": "2015-11-14T22:33:32",
+ "recorded_at": "2023-04-28T18:04:48",
"request": {
"body": {
"encoding": "utf-8",
@@ -18,7 +18,7 @@
"keep-alive"
],
"User-Agent": [
- "python-requests/2.8.1"
+ "python-requests/2.28.1"
]
},
"method": "GET",
@@ -26,8 +26,8 @@
},
"response": {
"body": {
- "encoding": null,
- "string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"*/*\", \n \"Accept-Encoding\": \"gzip, deflate\", \n \"Host\": \"httpbin.org\", \n \"User-Agent\": \"python-requests/2.8.1\"\n }, \n \"origin\": \"<IPADDR>\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
+ "encoding": "utf-8",
+ "string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"*/*\", \n \"Accept-Encoding\": \"gzip, deflate\", \n \"Host\": \"httpbin.org\", \n \"User-Agent\": \"python-requests/2.28.1\", \n \"X-Amzn-Trace-Id\": \"Root=1-644c0ac0-4986bed42b965a007af785e1\"\n }, \n \"origin\": \"83.198.52.66\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
},
"headers": {
"Access-Control-Allow-Credentials": [
@@ -40,16 +40,16 @@
"keep-alive"
],
"Content-Length": [
- "239"
+ "306"
],
"Content-Type": [
"application/json"
],
"Date": [
- "Sat, 14 Nov 2015 22:33:30 GMT"
+ "Fri, 28 Apr 2023 18:04:48 GMT"
],
"Server": [
- "nginx"
+ "gunicorn/19.9.0"
]
},
"status": {
@@ -60,5 +60,5 @@
}
}
],
- "recorded_with": "betamax/0.5.1"
+ "recorded_with": "betamax/0.8.2"
}
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
index 64b6ab3..e27c275 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py{27,37,38,39,310,311,py,py3},py{27,37}-flake8,noopenssl,docstrings
+envlist = py{27,37,38,39,310,311,py,py3},py{27,37}-flake8,noopenssl,docstrings,urllib3-2.0
[gh-actions]
python =
@@ -8,12 +8,13 @@ python =
3.8: py38
3.9: py39
3.10: py310
- 3.11: py311
+ 3.11: py311, urllib3-2.0
[testenv]
pip_pre = False
deps =
requests{env:REQUESTS_VERSION:>=2.0.1,<3.0.0}
+ urllib3<2.0.0
pytest
mock;python_version<"3.3"
pyopenssl
@@ -34,6 +35,12 @@ deps =
commands =
pytest -W error::DeprecationWarning {posargs}
+[testenv:urllib3-2.0]
+basepython = python3.11
+commands =
+ pip install -U urllib3>=2.0.0
+ pytest -W error::DeprecationWarning {posargs}
+
[testenv:py27-flake8]
basepython = python2.7
deps =