diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-07-12 18:45:00 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-07-12 18:55:17 +0200 |
commit | 1d918e31d8de675009c17baaba514c40c6598900 (patch) | |
tree | 85ba19f0b3a524e51f8895f6d547edc23aeadb5b /dev-python/responses | |
parent | dev-python/requests_pkcs12: Remove redundant versions (diff) | |
download | gentoo-1d918e31d8de675009c17baaba514c40c6598900.tar.gz gentoo-1d918e31d8de675009c17baaba514c40c6598900.tar.bz2 gentoo-1d918e31d8de675009c17baaba514c40c6598900.zip |
dev-python/responses: Remove redundant versions
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/responses')
-rw-r--r-- | dev-python/responses/Manifest | 1 | ||||
-rw-r--r-- | dev-python/responses/files/responses-0.10.7-fix-cookies.patch | 150 | ||||
-rw-r--r-- | dev-python/responses/responses-0.10.7.ebuild | 38 |
3 files changed, 0 insertions, 189 deletions
diff --git a/dev-python/responses/Manifest b/dev-python/responses/Manifest index 622617711540..eaaf34586f13 100644 --- a/dev-python/responses/Manifest +++ b/dev-python/responses/Manifest @@ -1,3 +1,2 @@ DIST responses-0.10.14.tar.gz 24782 BLAKE2B 2c233ad41bfc1d9eeaaf84d2e8a98f5f808e39ffbb50c796aed6a3065827a0c33301c8d6ed1e7c4d88e6d0f7378796bdaba3816fd558f5797a725ea99835c54c SHA512 f7edf64d4e6d62fa7295b6ac95d60bc30adbf0b141d9624ed7ca03efe02790973aa8ebd3f93187d0fdb41e323c1d87184717b77bba2ea70a7ae25f4d9237314f DIST responses-0.10.15.tar.gz 25350 BLAKE2B 6d9dff99e2dc18b7361cb2b75f0438c62ab771364b1a572823cf1fb0cdb6175fee8c4cd372ac5d1b27ef31b88e66dd7d1410429213af240f6f743f0c85e36d1b SHA512 513df58b40968e271cfb429ee09ab2ca7c3cf2f6ebe3607276ed1b949670871f8d6993449cfd5871bfd119cda0c0628dce6ebe8ed40595696e550541413f12b0 -DIST responses-0.10.7.tar.gz 22666 BLAKE2B 9f6d8ee0cc36ebb94bf6ac4284b474d30754af339f623a8a899061392321ba48a1f2d21593fb5bf2e6fac7c65ca6c252b6b7a1072e5548f91db489633aa3b686 SHA512 dcdbac1555090309b17eec1c02887eea5080321ff359afc42e6b558954caec2ab757e6009ae539e6e4d002cd06f2289d909a28ae583e6fa062a5df89c301e1ff diff --git a/dev-python/responses/files/responses-0.10.7-fix-cookies.patch b/dev-python/responses/files/responses-0.10.7-fix-cookies.patch deleted file mode 100644 index a744e652ea7f..000000000000 --- a/dev-python/responses/files/responses-0.10.7-fix-cookies.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff --git a/responses.py b/responses.py -index 9c57301..83fef83 100644 ---- a/responses.py -+++ b/responses.py -@@ -23,6 +23,10 @@ - from requests.packages.urllib3.response import HTTPResponse - except ImportError: - from urllib3.response import HTTPResponse -+try: -+ from requests.packages.urllib3.connection import HTTPHeaderDict -+except ImportError: -+ from urllib3.connection import HTTPHeaderDict - - if six.PY2: - from urlparse import urlparse, parse_qsl, urlsplit, urlunsplit -@@ -309,11 +313,11 @@ def _url_matches(self, url, other, match_querystring=False): - return False - - def get_headers(self): -- headers = {} -+ headers = HTTPHeaderDict() # Duplicate headers are legal - if self.content_type is not None: - headers["Content-Type"] = self.content_type - if self.headers: -- headers.update(self.headers) -+ headers.extend(self.headers) - return headers - - def get_response(self, request): -@@ -372,11 +376,20 @@ def get_response(self, request): - status = self.status - body = _handle_body(self.body) - -+ # The requests library's cookie handling depends on the response object -+ # having an original response object with the headers as the `msg`, so -+ # we give it what it needs. -+ orig_response = HTTPResponse( -+ body=body, # required to avoid "ValueError: Unable to determine whether fp is closed." -+ msg=headers, -+ preload_content=False, -+ ) - return HTTPResponse( - status=status, - reason=six.moves.http_client.responses.get(status), - body=body, - headers=headers, -+ original_response=orig_response, - preload_content=False, - ) - -@@ -402,13 +415,22 @@ def get_response(self, request): - raise body - - body = _handle_body(body) -- headers.update(r_headers) -- -+ headers.extend(r_headers) -+ -+ # The requests library's cookie handling depends on the response object -+ # having an original response object with the headers as the `msg`, so -+ # we give it what it needs. -+ orig_response = HTTPResponse( -+ body=body, # required to avoid "ValueError: Unable to determine whether fp is closed." -+ msg=headers, -+ preload_content=False, -+ ) - return HTTPResponse( - status=status, - reason=six.moves.http_client.responses.get(status), - body=body, - headers=headers, -+ original_response=orig_response, - preload_content=False, - ) - -@@ -619,11 +641,6 @@ def _on_request(self, adapter, request, **kwargs): - if not match.stream: - response.content # NOQA - -- try: -- response.cookies = _cookies_from_headers(response.headers) -- except (KeyError, TypeError): -- pass -- - response = resp_callback(response) if resp_callback else response - match.call_count += 1 - self._calls.add(request, response) -diff --git a/test_responses.py b/test_responses.py -index c2a4f01..65904de 100644 ---- a/test_responses.py -+++ b/test_responses.py -@@ -657,8 +657,56 @@ def run(): - assert resp.status_code == status - assert "session_id" in resp.cookies - assert resp.cookies["session_id"] == "12345" -- assert resp.cookies["a"] == "b" -- assert resp.cookies["c"] == "d" -+ assert set(resp.cookies.keys()) == set(["session_id"]) -+ -+ run() -+ assert_reset() -+ -+ -+def test_response_secure_cookies(): -+ body = b"test callback" -+ status = 200 -+ headers = {"set-cookie": "session_id=12345; a=b; c=d; secure"} -+ url = "http://example.com/" -+ -+ def request_callback(request): -+ return (status, headers, body) -+ -+ @responses.activate -+ def run(): -+ responses.add_callback(responses.GET, url, request_callback) -+ resp = requests.get(url) -+ assert resp.text == "test callback" -+ assert resp.status_code == status -+ assert "session_id" in resp.cookies -+ assert resp.cookies["session_id"] == "12345" -+ assert set(resp.cookies.keys()) == set(["session_id"]) -+ -+ run() -+ assert_reset() -+ -+ -+def test_response_cookies_multiple(): -+ body = b"test callback" -+ status = 200 -+ headers = [ -+ ("set-cookie", "1P_JAR=2019-12-31-23; path=/; domain=.example.com; HttpOnly"), -+ ("set-cookie", "NID=some=value; path=/; domain=.example.com; secure"), -+ ] -+ url = "http://example.com/" -+ -+ def request_callback(request): -+ return (status, headers, body) -+ -+ @responses.activate -+ def run(): -+ responses.add_callback(responses.GET, url, request_callback) -+ resp = requests.get(url) -+ assert resp.text == "test callback" -+ assert resp.status_code == status -+ assert set(resp.cookies.keys()) == set(["1P_JAR", "NID"]) -+ assert resp.cookies["1P_JAR"] == "2019-12-31-23" -+ assert resp.cookies["NID"] == "some=value" - - run() - assert_reset() diff --git a/dev-python/responses/responses-0.10.7.ebuild b/dev-python/responses/responses-0.10.7.ebuild deleted file mode 100644 index c3ba60ec5686..000000000000 --- a/dev-python/responses/responses-0.10.7.ebuild +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 -PYTHON_COMPAT=( python3_{6,7,8} pypy3 ) - -inherit distutils-r1 - -DESCRIPTION="Utility for mocking out the Python Requests library" -HOMEPAGE="https://github.com/getsentry/responses" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux" -IUSE="test" - -RDEPEND=" - >=dev-python/requests-2.0[${PYTHON_USEDEP}] - dev-python/cookies[${PYTHON_USEDEP}] - dev-python/mock[${PYTHON_USEDEP}] - dev-python/six[${PYTHON_USEDEP}] -" - -DEPEND=" - dev-python/setuptools[${PYTHON_USEDEP}] - test? ( - ${RDEPEND} - dev-python/pytest-localserver[${PYTHON_USEDEP}] - ) -" - -PATCHES=( - "${FILESDIR}/responses-0.10.7-fix-cookies.patch" - "${FILESDIR}/responses-0.10.7-tests.patch" -) - -distutils_enable_tests pytest |