mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
Removed default '80' port of uri in tests
This commit is contained in:
2
tests/fixtures/migration/new_cassette.json
vendored
2
tests/fixtures/migration/new_cassette.json
vendored
@@ -8,7 +8,7 @@
|
||||
"User-Agent": ["python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"]
|
||||
},
|
||||
"method": "GET",
|
||||
"uri": "http://httpbin.org:80/ip"
|
||||
"uri": "http://httpbin.org/ip"
|
||||
},
|
||||
"response": {
|
||||
"status": {
|
||||
|
||||
2
tests/fixtures/migration/new_cassette.yaml
vendored
2
tests/fixtures/migration/new_cassette.yaml
vendored
@@ -5,7 +5,7 @@
|
||||
Accept-Encoding: ['gzip, deflate, compress']
|
||||
User-Agent: ['python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0']
|
||||
method: GET
|
||||
uri: http://httpbin.org:80/ip
|
||||
uri: http://httpbin.org/ip
|
||||
response:
|
||||
body: {string: !!python/unicode "{\n \"origin\": \"217.122.164.194\"\n}"}
|
||||
headers: [!!python/unicode "Access-Control-Allow-Origin: *\r\n", !!python/unicode "Content-Type:
|
||||
|
||||
4
tests/fixtures/wild/domain_redirect.yaml
vendored
4
tests/fixtures/wild/domain_redirect.yaml
vendored
@@ -5,7 +5,7 @@
|
||||
Accept-Encoding: ['gzip, deflate, compress']
|
||||
User-Agent: ['vcrpy-test']
|
||||
method: GET
|
||||
uri: http://seomoz.org:80/
|
||||
uri: http://seomoz.org/
|
||||
response:
|
||||
body: {string: ''}
|
||||
headers: ["Location: http://moz.com/\r\n", "Server: BigIP\r\n", "Connection: Keep-Alive\r\n",
|
||||
@@ -18,7 +18,7 @@
|
||||
Accept-Encoding: ['gzip, deflate, compress']
|
||||
User-Agent: ['vcrpy-test']
|
||||
method: GET
|
||||
uri: http://moz.com:80/
|
||||
uri: http://moz.com/
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
|
||||
@@ -6,6 +6,6 @@ def test_recorded_request_url_with_redirected_request(tmpdir):
|
||||
with vcr.use_cassette(str(tmpdir.join('test.yml'))) as cass:
|
||||
assert len(cass) == 0
|
||||
urlopen('http://httpbin.org/redirect/3')
|
||||
assert cass.requests[0].url == 'http://httpbin.org:80/redirect/3'
|
||||
assert cass.requests[3].url == 'http://httpbin.org:80/get'
|
||||
assert cass.requests[0].url == 'http://httpbin.org/redirect/3'
|
||||
assert cass.requests[3].url == 'http://httpbin.org/get'
|
||||
assert len(cass) == 4
|
||||
|
||||
@@ -6,7 +6,7 @@ from vcr.request import Request
|
||||
def test_serialize_binary():
|
||||
request = Request(
|
||||
method='GET',
|
||||
uri='http://localhost:80/',
|
||||
uri='http://localhost/',
|
||||
body='',
|
||||
headers={},
|
||||
)
|
||||
|
||||
@@ -6,13 +6,13 @@ from vcr import request
|
||||
# the dict contains requests with corresponding to its key difference
|
||||
# with 'base' request.
|
||||
REQUESTS = {
|
||||
'base': request.Request('GET', 'http://host.com:80/p?a=b', '', {}),
|
||||
'method': request.Request('POST', 'http://host.com:80/p?a=b', '', {}),
|
||||
'base': request.Request('GET', 'http://host.com/p?a=b', '', {}),
|
||||
'method': request.Request('POST', 'http://host.com/p?a=b', '', {}),
|
||||
'scheme': request.Request('GET', 'https://host.com:80/p?a=b', '', {}),
|
||||
'host': request.Request('GET', 'http://another-host.com:80/p?a=b', '', {}),
|
||||
'host': request.Request('GET', 'http://another-host.com/p?a=b', '', {}),
|
||||
'port': request.Request('GET', 'http://host.com:90/p?a=b', '', {}),
|
||||
'path': request.Request('GET', 'http://host.com:80/x?a=b', '', {}),
|
||||
'query': request.Request('GET', 'http://host.com:80/p?c=d', '', {}),
|
||||
'path': request.Request('GET', 'http://host.com/x?a=b', '', {}),
|
||||
'query': request.Request('GET', 'http://host.com/p?c=d', '', {}),
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ def test_uri_matcher():
|
||||
|
||||
|
||||
def test_query_matcher():
|
||||
req1 = request.Request('GET', 'http://host.com:80/?a=b&c=d', '', {})
|
||||
req2 = request.Request('GET', 'http://host.com:80/?c=d&a=b', '', {})
|
||||
req1 = request.Request('GET', 'http://host.com/?a=b&c=d', '', {})
|
||||
req2 = request.Request('GET', 'http://host.com/?c=d&a=b', '', {})
|
||||
assert matchers.query(req1, req2)
|
||||
|
||||
req1 = request.Request('GET', 'http://host.com:80/?a=b&a=b&c=d', '', {})
|
||||
req2 = request.Request('GET', 'http://host.com:80/?a=b&c=d&a=b', '', {})
|
||||
req3 = request.Request('GET', 'http://host.com:80/?c=d&a=b&a=b', '', {})
|
||||
req1 = request.Request('GET', 'http://host.com/?a=b&a=b&c=d', '', {})
|
||||
req2 = request.Request('GET', 'http://host.com/?a=b&c=d&a=b', '', {})
|
||||
req3 = request.Request('GET', 'http://host.com/?c=d&a=b&a=b', '', {})
|
||||
assert matchers.query(req1, req2)
|
||||
assert matchers.query(req1, req3)
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ from vcr.request import Request
|
||||
|
||||
|
||||
def test_str():
|
||||
req = Request('GET', 'http://www.google.com:80/', '', {})
|
||||
str(req) == '<Request (GET) http://www.google.com:80/>'
|
||||
req = Request('GET', 'http://www.google.com/', '', {})
|
||||
str(req) == '<Request (GET) http://www.google.com/>'
|
||||
|
||||
|
||||
def test_headers():
|
||||
headers = {'X-Header1': ['h1'], 'X-Header2': 'h2'}
|
||||
req = Request('GET', 'http://go.com:80/', '', headers)
|
||||
req = Request('GET', 'http://go.com/', '', headers)
|
||||
assert req.headers == {'X-Header1': ['h1'], 'X-Header2': ['h2']}
|
||||
|
||||
req.add_header('X-Header1', 'h11')
|
||||
@@ -17,7 +17,7 @@ def test_headers():
|
||||
|
||||
def test_flat_headers_dict():
|
||||
headers = {'X-Header1': ['h1', 'h11'], 'X-Header2': ['h2']}
|
||||
req = Request('GET', 'http://go.com:80/', '', headers)
|
||||
req = Request('GET', 'http://go.com/', '', headers)
|
||||
assert req.flat_headers_dict() == {'X-Header1': 'h1', 'X-Header2': 'h2'}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user