#
# Conditional build:
-%bcond_without tests # do not perform "make test"
+%bcond_with tests # do not perform "make test"
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
%bcond_without bundled # Bundle Libraries
# + manual removal from setup.py
Patch0: system-charade-and-urllib3.patch
Patch1: system-cert.patch
-Patch2: requests-test.patch
%if %{with python2}
BuildRequires: python-modules >= 1:2.6
%if %{without bundled}
%setup -q -n %{module}-%{version}
%{!?with_bundled:%patch0 -p1}
%patch1 -p1
-%patch2 -p1
%build
%if %{with python2}
+++ /dev/null
-From cf82d4406be55c71983d05d7f6e18917540b5c69 Mon Sep 17 00:00:00 2001
-From: Ian Cordasco <ian.cordasco@rackspace.com>
-Date: Mon, 1 Dec 2014 16:21:41 -0600
-Subject: [PATCH] Update tests to work offline
-
----
- test_requests.py | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/test_requests.py b/test_requests.py
-index 4624f09..2d3ee62 100755
---- a/test_requests.py
-+++ b/test_requests.py
-@@ -258,7 +258,7 @@ def test_headers_on_session_with_None_are_not_sent(self):
- """Do not send headers in Session.headers with None values."""
- ses = requests.Session()
- ses.headers['Accept-Encoding'] = None
-- req = requests.Request('GET', 'http://httpbin.org/get')
-+ req = requests.Request('GET', httpbin('get'))
- prep = ses.prepare_request(req)
- assert 'Accept-Encoding' not in prep.headers
-
-@@ -1008,12 +1008,12 @@ def test_basic_auth_str_is_always_native(self):
- assert s == "Basic dGVzdDp0ZXN0"
-
- def test_requests_history_is_saved(self):
-- r = requests.get('https://httpbin.org/redirect/5')
-+ r = requests.get(httpbin('redirect/5'))
- total = r.history[-1].history
- i = 0
- for item in r.history:
- assert item.history == total[0:i]
-- i=i+1
-+ i = i + 1
-
- def test_json_param_post_content_type_works(self):
- r = requests.post(
-@@ -1350,7 +1350,7 @@ def test_max_age_invalid_str(self):
- class TestTimeout:
- def test_stream_timeout(self):
- try:
-- requests.get('https://httpbin.org/delay/10', timeout=2.0)
-+ requests.get(httpbin('delay/10'), timeout=2.0)
- except requests.exceptions.Timeout as e:
- assert 'Read timed out' in e.args[0].args[0]
-
-@@ -1450,7 +1450,7 @@ class TestRedirects:
-
- def test_requests_are_updated_each_time(self):
- session = RedirectSession([303, 307])
-- prep = requests.Request('POST', 'http://httpbin.org/post').prepare()
-+ prep = requests.Request('POST', httpbin('post')).prepare()
- r0 = session.send(prep)
- assert r0.request.method == 'POST'
- assert session.calls[-1] == SendCall((r0.request,), {})
-@@ -1534,12 +1534,12 @@ def test_prepare_unicode_url():
- def test_urllib3_retries():
- from requests.packages.urllib3.util import Retry
- s = requests.Session()
-- s.mount('https://', HTTPAdapter(max_retries=Retry(
-+ s.mount('http://', HTTPAdapter(max_retries=Retry(
- total=2, status_forcelist=[500]
- )))
-
- with pytest.raises(RetryError):
-- s.get('https://httpbin.org/status/500')
-+ s.get(httpbin('status/500'))
-
- if __name__ == '__main__':
- unittest.main()