forked from pool/python-vcrpy
- Update to 2.1.0:
* Add a rewind method to reset a cassette (thanks @khamidou) * New error message with more details on why the cassette failed to play a request (thanks @arthurHamon2, @neozenith) * Handle connect tunnel URI (thanks @jeking3) * Drop support to python 3.4 * Add deprecation warning on python 2.7, next major release will drop python 2.7 support - Drop merged patch python-vcrpy-fix-tunnel-uri-generation.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-vcrpy?expand=0&rev=16
This commit is contained in:
committed by
Git OBS Bridge
parent
163b59d63e
commit
de2b6ee921
@@ -1,75 +0,0 @@
|
|||||||
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,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 16 10:48:31 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
- Update to 2.1.0:
|
||||||
|
* Add a rewind method to reset a cassette (thanks @khamidou)
|
||||||
|
* New error message with more details on why the cassette failed to play a request (thanks @arthurHamon2, @neozenith)
|
||||||
|
* Handle connect tunnel URI (thanks @jeking3)
|
||||||
|
* Drop support to python 3.4
|
||||||
|
* Add deprecation warning on python 2.7, next major release will drop python 2.7 support
|
||||||
|
- Drop merged patch python-vcrpy-fix-tunnel-uri-generation.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Apr 17 14:09:32 CEST 2019 - Matej Cepl <mcepl@suse.com>
|
Wed Apr 17 14:09:32 CEST 2019 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
@@ -19,14 +19,13 @@
|
|||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
Name: python-vcrpy
|
Name: python-vcrpy
|
||||||
Version: 2.0.1
|
Version: 2.1.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Python module to mock and replay HTTP interactions
|
Summary: Python module to mock and replay HTTP interactions
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: https://github.com/kevin1024/vcrpy
|
URL: https://github.com/kevin1024/vcrpy
|
||||||
Source: https://files.pythonhosted.org/packages/source/v/vcrpy/vcrpy-%{version}.tar.gz
|
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 PyYAML}
|
||||||
BuildRequires: %{python_module pytest-httpbin}
|
BuildRequires: %{python_module pytest-httpbin}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
@@ -59,7 +58,8 @@ This is a Python version of Ruby's VCR library.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n vcrpy-%{version}
|
%setup -q -n vcrpy-%{version}
|
||||||
%patch0 -p1
|
# online integration tests
|
||||||
|
rm -r tests/integration
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@@ -71,8 +71,7 @@ This is a Python version of Ruby's VCR library.
|
|||||||
%check
|
%check
|
||||||
# Skip TestVCRConnection.testing_connect. Attempts
|
# Skip TestVCRConnection.testing_connect. Attempts
|
||||||
# a real connection.
|
# a real connection.
|
||||||
# This just doesn't work gh#kevin1024/vcrpy#427
|
%pytest -k "not testing_connect"
|
||||||
# %%python_exec -m pytest -k "not testing_connect" tests
|
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:57be64aa8e9883a4117d0b15de28af62275c001abcdb00b6dc2d4406073d9a4f
|
|
||||||
size 63596
|
|
3
vcrpy-2.1.0.tar.gz
Normal file
3
vcrpy-2.1.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:0e79239441fb4c731da9f05aecbd062223ef1f4ab668d2400c63c347a7071414
|
||||||
|
size 71323
|
Reference in New Issue
Block a user