From 122e7580dbaaadf0715a373e90038365dd9f3238 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Wed, 14 Oct 2020 18:58:43 -0700 Subject: [PATCH] RHEL 9.0.0 Alpha bootstrap The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/python-httpretty#3a4b12f807adb9bfd4fca9903fb23946aad98ce1 --- .gitignore | 6 + ...retty-fakesock_getpeercert_noconnect.patch | 58 ++++ python-httpretty.spec | 281 ++++++++++++++++++ skip-test_passthrough.patch | 19 ++ sources | 1 + 5 files changed, 365 insertions(+) create mode 100644 python-httpretty-fakesock_getpeercert_noconnect.patch create mode 100644 python-httpretty.spec create mode 100644 skip-test_passthrough.patch create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..c9fed39 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,6 @@ +/httpretty-0.8.3.tar.gz +/HTTPretty-70af1f8.tar.gz +/httpretty-0.9.5.tar.gz +/httpretty-0.9.6.tar.gz +/httpretty-0.9.7.tar.gz +/httpretty-1.0.2.tar.gz diff --git a/python-httpretty-fakesock_getpeercert_noconnect.patch b/python-httpretty-fakesock_getpeercert_noconnect.patch new file mode 100644 index 0000000..6fd10d3 --- /dev/null +++ b/python-httpretty-fakesock_getpeercert_noconnect.patch @@ -0,0 +1,58 @@ +diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit/test_core.py +--- httpretty-1.0.2/tests/unit/test_core.py.orig 2020-03-20 01:54:16.000000000 +0100 ++++ httpretty-1.0.2/tests/unit/test_core.py 2020-03-27 11:14:13.000000000 +0100 +@@ -190,28 +190,35 @@ def test_fake_ssl_socket_proxies_its_ow_ + @freeze_time("2013-10-04 04:20:00") + def test_fakesock_socket_getpeercert(): + ("fakesock.socket#getpeercert should return a hardcoded fake certificate") +- # Given a fake socket instance +- socket = fakesock.socket() + +- # And that it's bound to some host +- socket._host = 'somewhere.com' ++ # Don't bother with an actual remote roundtrip ++ httpretty.allow_net_connect = False + +- # When I retrieve the peer certificate +- certificate = socket.getpeercert() ++ try: ++ # Given a fake socket instance ++ socket = fakesock.socket() + +- # 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'*') +- ) +- }) ++ # And that it's bound to some host ++ socket._host = 'somewhere.com' ++ ++ # 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 new file mode 100644 index 0000000..2759362 --- /dev/null +++ b/python-httpretty.spec @@ -0,0 +1,281 @@ +%if (%{defined rhel} && 0%{?rhel} < 8) || (%{defined fedora} && 0%{?fedora} < 30) +%bcond_without python2 +%endif +%bcond_without python3 + +%global github_owner gabrielfalcao +%global github_name HTTPretty +%global srcname httpretty +# define these only if actually building from a GH snapshot not a release tarball +#global github_commit 70af1f8cf925ef50cb5e72212fb0aa46e1451dc3 +#global shortcommit %%(c=%%{github_commit}; echo ${c:0:7}) +#global github_date 20161011 + + +%if %{defined fedora} && 0%{?fedora} < 34 +%global run_tests 1 +%else +%global run_tests 0 +%endif + +Name: python-httpretty +Version: 1.0.2 +# If github_date is defined, assume a post-release snapshot +Release: 4%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} +Summary: HTTP request mock tool for Python + +License: MIT +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{pypi_source} +# Alternative for building from a github snapshot +#Source0: https://github.com/%%{github_owner}/%%{github_name}/archive/%%{github_commit}/%%{github_name}-%%{shortcommit}.tar.gz + +# Avoid unnecessary remote access requirement (note: test only actually +# does a remote connection after PR #313) +Patch1: python-httpretty-fakesock_getpeercert_noconnect.patch + +# Remote access (these tests were skipped upstream in <= 0.9.7) +Patch2: skip-test_passthrough.patch + +BuildArch: noarch + +%global _description\ +Once upon a time a python developer wanted to use a RESTful API, everything was\ +fine but until the day he needed to test the code that hits the RESTful API:\ +what if the API server is down? What if its content has changed?\ +\ +Don't worry, HTTPretty is here for you. + +%description %_description + +%if %{with python2} +%package -n python2-httpretty +Summary: %summary +Requires: python%{?fedora:2}-six + +BuildRequires: python2-devel +BuildRequires: python2-setuptools +# For tests +BuildRequires: python%{?fedora:2}-httplib2 +BuildRequires: python%{?fedora:2}-mock +BuildRequires: python%{?fedora:2}-nose +BuildRequires: python%{?fedora:2}-requests +BuildRequires: python%{?fedora:2}-sure +BuildRequires: python%{?fedora:2}-urllib3 +BuildRequires: python%{?fedora:2}-tornado +BuildRequires: python%{?fedora:2}-eventlet +BuildRequires: python%{?fedora:2}-freezegun +BuildRequires: python%{?fedora:2}-redis +%if 0%{?epel} == 6 +# Need unittest2 to get the 'skip' decorator +BuildRequires: python-unittest2 +%endif +%{?python_provide:%python_provide python2-httpretty} + +%description -n python2-httpretty %_description +%endif + +%if %{with python3} +%package -n python3-httpretty +Summary: HTTP request mock tool for Python 3 +Requires: python%{python3_pkgversion}-six + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +# For tests +BuildRequires: python%{python3_pkgversion}-httplib2 +BuildRequires: python%{python3_pkgversion}-mock +BuildRequires: python%{python3_pkgversion}-nose +BuildRequires: python%{python3_pkgversion}-requests +BuildRequires: python%{python3_pkgversion}-sure +BuildRequires: python%{python3_pkgversion}-urllib3 +BuildRequires: python%{python3_pkgversion}-tornado +BuildRequires: python%{python3_pkgversion}-eventlet +BuildRequires: python%{python3_pkgversion}-freezegun +BuildRequires: python%{python3_pkgversion}-redis + +%description -n python3-httpretty +Once upon a time a python developer wanted to use a RESTful API, everything was +fine but until the day he needed to test the code that hits the RESTful API: +what if the API server is down? What if its content has changed? + +Don't worry, HTTPretty is here for you. +%endif + +%prep +%autosetup -n httpretty-%{version} -p1 + +# Alternative for building from commit tarball +#autosetup -n %%{github_name}-%%{github_commit} -p1 + +# nose plugins we don't have yet +sed -i 's/^with-randomly = 1$//' setup.cfg +sed -i 's/^rednose = 1$//' setup.cfg + +%build +%if %{with python2} +# setup.py contains non-ASCII characters; in Koji build environment +# default encoding is ASCII and this will choke, so set a UTF-8 locale +LANG=C.UTF-8 %py2_build +%endif + +%if %{with_python3} +%py3_build +%endif + +%install +%if %{with python2} +LANG=C.UTF-8 %py2_install +%endif + +%if %{with_python3} +%py3_install +%endif + + +%check +%if %{run_tests} + +%if %{with python2} +LANG=C.UTF-8 %{__python2} -m nose -v +%endif + +%if %{with_python3} +%{__python3} -m nose -v +%endif + +%endif + + +%if %{with python2} +%files -n python2-httpretty +%doc README.rst +%license COPYING +%{python2_sitelib}/httpretty +%{python2_sitelib}/httpretty-%{version}-py2.?.egg-info +%endif + +%if %{with_python3} +%files -n python3-httpretty +%doc README.rst +%license COPYING +%{python3_sitelib}/httpretty +%{python3_sitelib}/httpretty-%{version}-py3.?.egg-info +%endif + + +%changelog +* Tue Oct 13 2020 Jiri Popelka - 1.0.2-4 +- Temporarily run tests on Fedora < 34 only + +* Wed Jul 29 2020 Fedora Release Engineering - 1.0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sun May 24 2020 Miro Hrončok - 1.0.2-2 +- Rebuilt for Python 3.9 + +* Fri Mar 27 2020 Jiri Popelka - 1.0.2-1 +- 1.0.2 + +* Thu Jan 30 2020 Fedora Release Engineering - 0.9.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jan 08 2020 Charalampos Stratakis - 0.9.7-1 +- Update to 0.9.7 (rhbz#1759992) + +* Thu Oct 03 2019 Miro Hrončok - 0.9.6-4 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 0.9.6-3 +- Rebuilt for Python 3.8 + +* Tue Aug 06 2019 Jiri Popelka - 0.9.6-2 +- Escape macro in comment + +* Tue Jul 30 2019 Jiri Popelka - 0.9.6-1 +- Update to 0.9.6 +- Disable python2 subpackage on F30+ + +* Fri Jul 26 2019 Fedora Release Engineering - 0.9.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 0.9.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek - 0.9.5-4 +- Drop explicit locale setting for python3, use C.UTF-8 for python2 + See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot + +* Sat Jul 14 2018 Fedora Release Engineering - 0.9.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jun 18 2018 Miro Hrončok - 0.9.5-2 +- Rebuilt for Python 3.7 + +* Wed Jun 06 2018 Miro Hrončok - 0.9.5-1 +- Update to 0.9.5, fix for Python 3.7 (#1580060) + +* Sat May 19 2018 Miro Hrončok - 0.9.4-1 +- Update to 0.9.4 (#1572888) + +* Wed Feb 21 2018 Iryna Shcherbina - 0.8.14-8.20161011git70af1f8 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 0.8.14-7.20161011git70af1f8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Sep 29 2017 Troy Dawson - 0.8.14-6.20161011git70af1f8 +- Cleanup spec file conditionals + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 0.8.14-5.20161011git70af1f8 +- Python 2 binary package renamed to python2-httpretty + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Jul 27 2017 Fedora Release Engineering - 0.8.14-4.20161011git70af1f8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.8.14-3.20161011git70af1f8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Jan 27 2017 Adam Williamson - 0.8.14-2.20161011git70af1f8 +- Backport PR #317 (call reset from setUp / tearDown) - thanks gholms + +* Fri Jan 06 2017 Adam Williamson - 0.8.14-1.20161011git70af1f8 +- Update to current git master (as a 0.8.14 post-release snapshot) +- Backport PR #313 (fix with recent OpenSSL, requests and urllib3) +- Backport PR #314 (fix a test with Python 3) +- Backport PR #315 (fix some issues with urllib 1.10, as found in RHEL 6) +- Avoid an unnecessary remote roundtrip in one of the tests +- Replace dependency 'un-pinning' patch with some sed commands in the spec +- Replace ASCII patch by running setup.py with a UTF-8 LANG +- Enable the tests, with necessary buildrequires + +* Tue Dec 13 2016 Charalampos Stratakis - 0.8.3-8 +- Rebuild for Python 3.6 + +* Tue Jul 19 2016 Fedora Release Engineering - 0.8.3-7 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 0.8.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 0.8.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.8.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Mar 02 2015 Jamie Lennox - 0.8.3-3 +- Added conditional __python2 macros for building on RHEL 6. + +* Tue Feb 24 2015 Jamie Lennox - 0.8.3-2 +- Added with_python3 build flags to enable building on EPEL. + +* Mon Jul 28 2014 Jamie Lennox - 0.8.3-1 +- Updated to new version. +- Removed check, there are simply too many problems upstream. + +* Mon Mar 10 2014 Jamie Lennox - 0.8.0-1 +- Initial package. + diff --git a/skip-test_passthrough.patch b/skip-test_passthrough.patch new file mode 100644 index 0000000..37f4a74 --- /dev/null +++ b/skip-test_passthrough.patch @@ -0,0 +1,19 @@ +diff -up httpretty-1.0.2/tests/functional/test_passthrough.py.orig httpretty-1.0.2/tests/functional/test_passthrough.py +--- httpretty-1.0.2/tests/functional/test_passthrough.py.orig 2020-03-10 04:08:59.000000000 +0100 ++++ httpretty-1.0.2/tests/functional/test_passthrough.py 2020-03-27 11:40:51.716073339 +0100 +@@ -36,6 +36,7 @@ def http(): + return sess + + ++@skip + def test_http_passthrough(): + url = 'http://httpbin.org/status/200' + response1 = http().get(url) +@@ -58,6 +59,7 @@ def test_http_passthrough(): + (response4.content).should.equal(response1.content) + + ++@skip + def test_https_passthrough(): + url = 'https://raw.githubusercontent.com/gabrielfalcao/httpretty/master/COPYING' + diff --git a/sources b/sources new file mode 100644 index 0000000..cf1bbc1 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (httpretty-1.0.2.tar.gz) = f9ef1c82f4fe3a31696e06228cea512664c5118b3c32910d7810d1fcf16b05d31b9b55db7bb6bd64967aadb162a2952757627439769db9117164b8248de9049c