forked from pool/python-vcrpy
Accepting request 662049 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/662049 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-vcrpy?expand=0&rev=3
This commit is contained in:
75
python-vcrpy-fix-tunnel-uri-generation.patch
Normal file
75
python-vcrpy-fix-tunnel-uri-generation.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
From a4e60d4bb10f49ec212ec89e9a632dc42e4fd477 Mon Sep 17 00:00:00 2001
|
||||
From: "James E. King III" <jking@apache.org>
|
||||
Date: Sat, 22 Dec 2018 17:21:25 +0000
|
||||
Subject: [PATCH] properly handle tunnel connect uri generation broken in #389
|
||||
|
||||
---
|
||||
tests/unit/test_request.py | 25 ++++++++++++++++---------
|
||||
vcr/request.py | 5 ++++-
|
||||
2 files changed, 20 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tests/unit/test_request.py b/tests/unit/test_request.py
|
||||
index dfd68d7..00793f8 100644
|
||||
--- a/tests/unit/test_request.py
|
||||
+++ b/tests/unit/test_request.py
|
||||
@@ -3,9 +3,13 @@
|
||||
from vcr.request import Request, HeadersDict
|
||||
|
||||
|
||||
-def test_str():
|
||||
- req = Request('GET', 'http://www.google.com/', '', {})
|
||||
- str(req) == '<Request (GET) http://www.google.com/>'
|
||||
+@pytest.mark.parametrize("method, uri, expected_str", [
|
||||
+ ('GET', 'http://www.google.com/', '<Request (GET) http://www.google.com/>'),
|
||||
+ ('OPTIONS', '*', '<Request (OPTIONS) *>'),
|
||||
+ ('CONNECT', 'host.some.where:1234', '<Request (CONNECT) host.some.where:1234>')
|
||||
+])
|
||||
+def test_str(method, uri, expected_str):
|
||||
+ assert str(Request(method, uri, '', {})) == expected_str
|
||||
|
||||
|
||||
def test_headers():
|
||||
@@ -29,18 +33,21 @@ def test_add_header_deprecated():
|
||||
('https://go.com/', 443),
|
||||
('https://go.com:443/', 443),
|
||||
('https://go.com:3000/', 3000),
|
||||
+ ('*', None)
|
||||
])
|
||||
def test_port(uri, expected_port):
|
||||
req = Request('GET', uri, '', {})
|
||||
assert req.port == expected_port
|
||||
|
||||
|
||||
-def test_uri():
|
||||
- req = Request('GET', 'http://go.com/', '', {})
|
||||
- assert req.uri == 'http://go.com/'
|
||||
-
|
||||
- req = Request('GET', 'http://go.com:80/', '', {})
|
||||
- assert req.uri == 'http://go.com:80/'
|
||||
+@pytest.mark.parametrize("method, uri", [
|
||||
+ ('GET', 'http://go.com/'),
|
||||
+ ('GET', 'http://go.com:80/'),
|
||||
+ ('CONNECT', 'localhost:1234'),
|
||||
+ ('OPTIONS', '*')
|
||||
+])
|
||||
+def test_uri(method, uri):
|
||||
+ assert Request(method, uri, '', {}).uri == uri
|
||||
|
||||
|
||||
def test_HeadersDict():
|
||||
diff --git a/vcr/request.py b/vcr/request.py
|
||||
index e268053..dfd6d46 100644
|
||||
--- a/vcr/request.py
|
||||
+++ b/vcr/request.py
|
||||
@@ -58,7 +58,10 @@ def port(self):
|
||||
parse_uri = urlparse(self.uri)
|
||||
port = parse_uri.port
|
||||
if port is None:
|
||||
- port = {'https': 443, 'http': 80}[parse_uri.scheme]
|
||||
+ try:
|
||||
+ port = {'https': 443, 'http': 80}[parse_uri.scheme]
|
||||
+ except KeyError:
|
||||
+ pass
|
||||
return port
|
||||
|
||||
@property
|
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 29 15:56:43 UTC 2018 - mardnh@gmx.de
|
||||
|
||||
- Add patch:
|
||||
* python-vcrpy-fix-tunnel-uri-generation.patch
|
||||
Needed for python-pyvmomi
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 24 15:24:59 UTC 2018 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/kevin1024/vcrpy
|
||||
Source: https://files.pythonhosted.org/packages/source/v/vcrpy/vcrpy-%{version}.tar.gz
|
||||
Patch0: python-vcrpy-fix-tunnel-uri-generation.patch
|
||||
BuildRequires: %{python_module PyYAML}
|
||||
BuildRequires: %{python_module pytest-httpbin}
|
||||
BuildRequires: %{python_module pytest}
|
||||
@@ -58,6 +59,7 @@ This is a Python version of Ruby's VCR library.
|
||||
|
||||
%prep
|
||||
%setup -q -n vcrpy-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
Reference in New Issue
Block a user