summaryrefslogtreecommitdiff
path: root/dev-python/responses
diff options
context:
space:
mode:
authorPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
committerPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
commitecdac123787b96ce6649f0f91da12ea6458cc2b1 (patch)
treeb89c74d9e6fe6e8aebc4c77bcbeb4ab73214127d /dev-python/responses
parent1be72aa41cf41dedadeecf59dca9f01de6381f5e (diff)
downloadbaldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.gz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.xz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.zip
Updating liguros repo
Diffstat (limited to 'dev-python/responses')
-rw-r--r--dev-python/responses/Manifest3
-rw-r--r--dev-python/responses/files/responses-0.10.7-fix-cookies.patch150
-rw-r--r--dev-python/responses/files/responses-0.10.7-tests.patch12
-rw-r--r--dev-python/responses/metadata.xml14
-rw-r--r--dev-python/responses/responses-0.10.14.ebuild42
-rw-r--r--dev-python/responses/responses-0.10.15.ebuild31
-rw-r--r--dev-python/responses/responses-0.10.7.ebuild38
7 files changed, 290 insertions, 0 deletions
diff --git a/dev-python/responses/Manifest b/dev-python/responses/Manifest
new file mode 100644
index 000000000000..622617711540
--- /dev/null
+++ b/dev-python/responses/Manifest
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 000000000000..a744e652ea7f
--- /dev/null
+++ b/dev-python/responses/files/responses-0.10.7-fix-cookies.patch
@@ -0,0 +1,150 @@
+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/files/responses-0.10.7-tests.patch b/dev-python/responses/files/responses-0.10.7-tests.patch
new file mode 100644
index 000000000000..764b22ab3af3
--- /dev/null
+++ b/dev-python/responses/files/responses-0.10.7-tests.patch
@@ -0,0 +1,12 @@
+diff --git a/test_responses.py b/test_responses.py
+index c2a4f01..2b85172 100644
+--- a/test_responses.py
++++ b/test_responses.py
+@@ -928,6 +928,7 @@ def _quote(s):
+ return responses.quote(responses._ensure_str(s))
+
+
++@pytest.mark.skipif(six.PY2, reason="Broken on python2")
+ def test_cookies_from_headers():
+ text = "こんにちは/世界"
+ quoted_text = _quote(text)
diff --git a/dev-python/responses/metadata.xml b/dev-python/responses/metadata.xml
new file mode 100644
index 000000000000..a68196fa3597
--- /dev/null
+++ b/dev-python/responses/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="pypi">responses</remote-id>
+ <remote-id type="github">getsentry/responses</remote-id>
+ <bugs-to>https://github.com/getsentry/responses/issues</bugs-to>
+ </upstream>
+ <origin>gentoo-staging</origin>
+</pkgmetadata>
diff --git a/dev-python/responses/responses-0.10.14.ebuild b/dev-python/responses/responses-0.10.14.ebuild
new file mode 100644
index 000000000000..6010ef70932e
--- /dev/null
+++ b/dev-python/responses/responses-0.10.14.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6..9} 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/six[${PYTHON_USEDEP}]
+"
+
+BDEPEND="
+ test? (
+ ${RDEPEND}
+ dev-python/pytest-localserver[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/responses-0.10.7-tests.patch"
+)
+
+distutils_enable_tests pytest
+
+src_prepare() {
+ # py3.9, doesn't look important
+ sed -e 's:test_arbitrary_status_code:_&:' \
+ -i test_responses.py || die
+ distutils-r1_src_prepare
+}
diff --git a/dev-python/responses/responses-0.10.15.ebuild b/dev-python/responses/responses-0.10.15.ebuild
new file mode 100644
index 000000000000..adae6e7ab45c
--- /dev/null
+++ b/dev-python/responses/responses-0.10.15.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6..9} 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/six[${PYTHON_USEDEP}]
+"
+
+BDEPEND="
+ test? (
+ ${RDEPEND}
+ dev-python/pytest-localserver[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests pytest
diff --git a/dev-python/responses/responses-0.10.7.ebuild b/dev-python/responses/responses-0.10.7.ebuild
new file mode 100644
index 000000000000..c3ba60ec5686
--- /dev/null
+++ b/dev-python/responses/responses-0.10.7.ebuild
@@ -0,0 +1,38 @@
+# 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