diff --git a/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch b/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch deleted file mode 100644 index 06a389fa7e8abdc9fe585cac7c9eba7ccfa4b552..0000000000000000000000000000000000000000 --- a/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 01474bf64e0434881059a3638abff5bb62eaedb1 Mon Sep 17 00:00:00 2001 -From: Scott Moser -Date: Tue, 24 Jan 2017 12:30:47 -0500 -Subject: [PATCH] Call reset from setUp and tearDown in addition to enable and - disable. - -When decorating a class via setUp and tearDown, reset() was not being -called. That was an unintentional change in behavior from previous versions. - -Addresses #316. ---- - httpretty/core.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/httpretty/core.py b/httpretty/core.py -index 4f72678..25df1fd 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -1580,6 +1580,7 @@ def httprettified(test): - else None) - - def new_setUp(self): -+ httpretty.reset() - httpretty.enable() - if use_addCleanup: - self.addCleanup(httpretty.disable) -@@ -1594,6 +1595,7 @@ def httprettified(test): - - def new_tearDown(self): - httpretty.disable() -+ httpretty.reset() - if original_tearDown: - original_tearDown(self) - klass.tearDown = new_tearDown --- -2.9.3 - diff --git a/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch b/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch deleted file mode 100644 index eb4ca434d17acc6d14e820e884f4c102bb0f92e1..0000000000000000000000000000000000000000 --- a/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 5d2f8d99c28519fe0cf47ebf5f043928d422b757 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Fri, 6 Jan 2017 17:56:43 -0800 -Subject: [PATCH] Handle bugs in older urllib3 versions in one of the tests - -Older urllib3 versions had a bug where they lower-cased header -names (in response header dicts). That makes one of our tests -fail with older urllib3, because the test expects a 'Server' -header. As this isn't our fault at all, just have the test cope -with it by checking if the header dict has a 'server' key and -replacing it with a 'Server' key with the same value. - -urllib3 1.10 also had a bug when you called dict() on its -HTTPHeaderDict class; it would turn this: - -{'headername': 'value'} - -Into this: - -{'headername': ['headername', 'value']} - -That was fixed in 1.11, but RHEL 6 still has 1.10, so let's -work with that by doing dict(headerdict.items()) instead of -just dict(headerdict) (when we're recording the calls). ---- - httpretty/core.py | 7 ++++++- - tests/functional/test_requests.py | 5 +++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/httpretty/core.py b/httpretty/core.py -index 34d1ed1..0c2d334 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -971,7 +971,12 @@ class httpretty(HttpBaseClass): - 'response': { - 'status': response.status, - 'body': decode_utf8(response.data), -- 'headers': dict(response.headers) -+ # urllib3 1.10 had a bug if you just did: -+ # dict(response.headers) -+ # which would cause all the values to become lists -+ # with the header name as the first item and the -+ # true value as the second item. Workaround that -+ 'headers': dict(response.headers.items()) - } - }) - cls.enable() -diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py -index 4e2063e..18c89f8 100644 ---- a/tests/functional/test_requests.py -+++ b/tests/functional/test_requests.py -@@ -742,6 +742,11 @@ def test_recording_calls(port): - response['response'].should.have.key("status").being.equal(200) - response['response'].should.have.key("body").being.an(text_type) - response['response'].should.have.key("headers").being.a(dict) -+ # older urllib3 had a bug where header keys were lower-cased: -+ # https://github.com/shazow/urllib3/issues/236 -+ # cope with that -+ if 'server' in response['response']["headers"]: -+ response['response']["headers"]["Server"] = response['response']["headers"].pop("server") - response['response']["headers"].should.have.key("Server").being.equal("TornadoServer/" + tornado_version) - - # And When I playback the previously recorded calls --- -2.11.0 - diff --git a/0001-modify-python3.9-supportive-syntax.patch b/0001-modify-python3.9-supportive-syntax.patch deleted file mode 100644 index 334e55b345e1cef02ef53c2d062c8a3cc06668e0..0000000000000000000000000000000000000000 --- a/0001-modify-python3.9-supportive-syntax.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3cd5647803ee66ab3e8548fb0903ac9b872a95d1 Mon Sep 17 00:00:00 2001 -From: bzg1107 -Date: Wed, 5 Jan 2022 12:48:56 +0800 -Subject: [PATCH] modify python3.9 supportive syntax - ---- - httpretty/core.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/httpretty/core.py b/httpretty/core.py -index d1aa8d0..eeb55cf 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -435,7 +435,7 @@ class fakesock(object): - else: - timeout = self.timeout - t.join(timeout) -- if t.isAlive(): -+ if t.is_alive(): - raise socket.timeout - - return self.fd --- -2.30.0 - diff --git a/httpretty-0.9.5.tar.gz b/httpretty-0.9.5.tar.gz deleted file mode 100644 index 6b29bd114b07dc257f91c06f4bef00a4744caf7d..0000000000000000000000000000000000000000 Binary files a/httpretty-0.9.5.tar.gz and /dev/null differ diff --git a/httpretty-1.1.4.tar.gz b/httpretty-1.1.4.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c2e08d0df86d28e7cb1cc460b34b9155f895cd0e Binary files /dev/null and b/httpretty-1.1.4.tar.gz differ diff --git a/python-httpretty-fakesock_getpeercert_noconnect.patch b/python-httpretty-fakesock_getpeercert_noconnect.patch deleted file mode 100644 index 16bdcd7e7857aaaa0dc61b1bf4abd796991ba6b4..0000000000000000000000000000000000000000 --- a/python-httpretty-fakesock_getpeercert_noconnect.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- HTTPretty/tests/unit/test_core.py 2017-01-06 15:04:06.030520764 -0800 -+++ HTTPretty/tests/unit/test_core.py.new 2017-01-06 15:37:17.932752818 -0800 -@@ -192,31 +192,37 @@ - @patch('httpretty.core.datetime') - def test_fakesock_socket_getpeercert(dt): - ("fakesock.socket#getpeercert should return a hardcoded fake certificate") -- # Background: -- dt.now.return_value = datetime(2013, 10, 4, 4, 20, 0) -+ # Don't bother with an actual remote roundtrip -+ httpretty.allow_net_connect = False - -- # Given a fake socket instance -- socket = fakesock.socket() -- -- # And that it's bound to some host and port -- socket.connect(('somewhere.com', 80)) -- -- # When I retrieve the peer certificate -- certificate = socket.getpeercert() -- -- # Then it should return a hardcoded value -- certificate.should.equal({ -- u'notAfter': 'Sep 29 04:20:00 GMT', -- u'subject': ( -- ((u'organizationName', u'*.somewhere.com'),), -- ((u'organizationalUnitName', u'Domain Control Validated'),), -- ((u'commonName', u'*.somewhere.com'),)), -- u'subjectAltName': ( -- (u'DNS', u'*.somewhere.com'), -- (u'DNS', u'somewhere.com'), -- (u'DNS', u'*') -- ) -- }) -+ try: -+ # Background: -+ dt.now.return_value = datetime(2013, 10, 4, 4, 20, 0) -+ -+ # Given a fake socket instance -+ socket = fakesock.socket() -+ -+ # And that it's bound to some host and port -+ socket.connect(('somewhere.com', 80)) -+ -+ # When I retrieve the peer certificate -+ certificate = socket.getpeercert() -+ -+ # Then it should return a hardcoded value -+ certificate.should.equal({ -+ u'notAfter': 'Sep 29 04:20:00 GMT', -+ u'subject': ( -+ ((u'organizationName', u'*.somewhere.com'),), -+ ((u'organizationalUnitName', u'Domain Control Validated'),), -+ ((u'commonName', u'*.somewhere.com'),)), -+ u'subjectAltName': ( -+ (u'DNS', u'*.somewhere.com'), -+ (u'DNS', u'somewhere.com'), -+ (u'DNS', u'*') -+ ) -+ }) -+ finally: -+ httpretty.allow_net_connect = True - - - def test_fakesock_socket_ssl(): diff --git a/python-httpretty.spec b/python-httpretty.spec index 0f2a4693f45ded92de89a57d5574b1c9ddbe12be..27e7c955eefe05456c96ea060b7a50bb2f6a8158 100644 --- a/python-httpretty.spec +++ b/python-httpretty.spec @@ -1,15 +1,12 @@ Name: python-httpretty -Version: 0.9.5 -Release: 6 +Version: 1.1.4 +Release: 1 Summary: HTTP Client mocking tool for Python License: MIT URL: https://pypi.org/project/httpretty/ Source0: https://files.pythonhosted.org/packages/source/h/httpretty/httpretty-%{version}.tar.gz - -Patch0001: python-httpretty-fakesock_getpeercert_noconnect.patch -Patch0002: 0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch -Patch0003: 0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch -Patch0004: 0001-modify-python3.9-supportive-syntax.patch +# https://github.com/gabrielfalcao/HTTPretty/issues/457 +Patch0:test_handle_slashes.patch BuildArch: noarch @@ -18,9 +15,8 @@ HTTP Client mocking tool for Python.Provides a full fake TCP socket module. %package -n python3-httpretty Summary: HTTP Client mocking tool for Python3 -BuildRequires: python3-devel python3-setuptools python3-httplib2 python3-mock -BuildRequires: python3-requests python3-sure python3-urllib3 python3-tornado -BuildRequires: python3-pip python3-nose2 python3-unittest2 python3-pytest python3-httplib2 +BuildRequires: python3-devel python3-setuptools python3-httplib2 python3-mock python3-freezegun +BuildRequires: python3-requests python3-sure python3-urllib3 python3-tornado python3-nose2 Requires: python3-six %{?python_provide:%python_provide python3-httpretty} @@ -49,9 +45,12 @@ LANG=en_US.UTF-8 %{__python3} -m nose2 -v %doc README.rst %license COPYING %{python3_sitelib}/httpretty -%{python3_sitelib}/httpretty-%{version}-py3.?.egg-info +%{python3_sitelib}/httpretty-%{version}-py%{python3_version}.egg-info %changelog +* Thu Oct 27 2022 Ge Wang - 1.1.4-1 +- Update to version 1.1.4 + * Mon Jan 10 2022 baizhonggui - 0.9.5-6 - Replace nose from nose2 dependence. diff --git a/test_handle_slashes.patch b/test_handle_slashes.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca90ef366463364030ea18faffea50cb321b14ed --- /dev/null +++ b/test_handle_slashes.patch @@ -0,0 +1,9 @@ +diff -Nur a/tests/functional/test_requests.py b/tests/functional/test_requests.py +--- a/tests/functional/test_requests.py 2021-05-14 09:02:06.000000000 +0800 ++++ b/tests/functional/test_requests.py 2022-08-27 15:44:21.935602830 +0800 +@@ -946,4 +946,4 @@ + response = requests.get('http://example.com//foo') + expect(response.text).to.equal('Find the best foo') + expect(HTTPretty.last_request.method).to.equal('GET') +- expect(HTTPretty.last_request.path).to.equal('//foo') ++ expect(HTTPretty.last_request.path).to.equal('/foo')