1
0
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:
Max Shytikov
2014-05-03 22:32:27 +02:00
parent 61e3bdc402
commit 1190a0e62e
7 changed files with 21 additions and 21 deletions

View File

@@ -8,7 +8,7 @@
"User-Agent": ["python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"] "User-Agent": ["python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"]
}, },
"method": "GET", "method": "GET",
"uri": "http://httpbin.org:80/ip" "uri": "http://httpbin.org/ip"
}, },
"response": { "response": {
"status": { "status": {

View File

@@ -5,7 +5,7 @@
Accept-Encoding: ['gzip, deflate, compress'] Accept-Encoding: ['gzip, deflate, compress']
User-Agent: ['python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0'] User-Agent: ['python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0']
method: GET method: GET
uri: http://httpbin.org:80/ip uri: http://httpbin.org/ip
response: response:
body: {string: !!python/unicode "{\n \"origin\": \"217.122.164.194\"\n}"} body: {string: !!python/unicode "{\n \"origin\": \"217.122.164.194\"\n}"}
headers: [!!python/unicode "Access-Control-Allow-Origin: *\r\n", !!python/unicode "Content-Type: headers: [!!python/unicode "Access-Control-Allow-Origin: *\r\n", !!python/unicode "Content-Type:

View File

@@ -5,7 +5,7 @@
Accept-Encoding: ['gzip, deflate, compress'] Accept-Encoding: ['gzip, deflate, compress']
User-Agent: ['vcrpy-test'] User-Agent: ['vcrpy-test']
method: GET method: GET
uri: http://seomoz.org:80/ uri: http://seomoz.org/
response: response:
body: {string: ''} body: {string: ''}
headers: ["Location: http://moz.com/\r\n", "Server: BigIP\r\n", "Connection: Keep-Alive\r\n", 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'] Accept-Encoding: ['gzip, deflate, compress']
User-Agent: ['vcrpy-test'] User-Agent: ['vcrpy-test']
method: GET method: GET
uri: http://moz.com:80/ uri: http://moz.com/
response: response:
body: body:
string: !!binary | string: !!binary |

View File

@@ -6,6 +6,6 @@ def test_recorded_request_url_with_redirected_request(tmpdir):
with vcr.use_cassette(str(tmpdir.join('test.yml'))) as cass: with vcr.use_cassette(str(tmpdir.join('test.yml'))) as cass:
assert len(cass) == 0 assert len(cass) == 0
urlopen('http://httpbin.org/redirect/3') urlopen('http://httpbin.org/redirect/3')
assert cass.requests[0].url == 'http://httpbin.org:80/redirect/3' assert cass.requests[0].url == 'http://httpbin.org/redirect/3'
assert cass.requests[3].url == 'http://httpbin.org:80/get' assert cass.requests[3].url == 'http://httpbin.org/get'
assert len(cass) == 4 assert len(cass) == 4

View File

@@ -6,7 +6,7 @@ from vcr.request import Request
def test_serialize_binary(): def test_serialize_binary():
request = Request( request = Request(
method='GET', method='GET',
uri='http://localhost:80/', uri='http://localhost/',
body='', body='',
headers={}, headers={},
) )

View File

@@ -6,13 +6,13 @@ from vcr import request
# the dict contains requests with corresponding to its key difference # the dict contains requests with corresponding to its key difference
# with 'base' request. # with 'base' request.
REQUESTS = { REQUESTS = {
'base': request.Request('GET', 'http://host.com:80/p?a=b', '', {}), 'base': request.Request('GET', 'http://host.com/p?a=b', '', {}),
'method': request.Request('POST', 'http://host.com:80/p?a=b', '', {}), 'method': request.Request('POST', 'http://host.com/p?a=b', '', {}),
'scheme': request.Request('GET', 'https://host.com:80/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', '', {}), 'port': request.Request('GET', 'http://host.com:90/p?a=b', '', {}),
'path': request.Request('GET', 'http://host.com:80/x?a=b', '', {}), 'path': request.Request('GET', 'http://host.com/x?a=b', '', {}),
'query': request.Request('GET', 'http://host.com:80/p?c=d', '', {}), 'query': request.Request('GET', 'http://host.com/p?c=d', '', {}),
} }
@@ -36,13 +36,13 @@ def test_uri_matcher():
def test_query_matcher(): def test_query_matcher():
req1 = request.Request('GET', 'http://host.com:80/?a=b&c=d', '', {}) req1 = request.Request('GET', 'http://host.com/?a=b&c=d', '', {})
req2 = request.Request('GET', 'http://host.com:80/?c=d&a=b', '', {}) req2 = request.Request('GET', 'http://host.com/?c=d&a=b', '', {})
assert matchers.query(req1, req2) assert matchers.query(req1, req2)
req1 = request.Request('GET', 'http://host.com:80/?a=b&a=b&c=d', '', {}) req1 = request.Request('GET', 'http://host.com/?a=b&a=b&c=d', '', {})
req2 = request.Request('GET', 'http://host.com:80/?a=b&c=d&a=b', '', {}) req2 = request.Request('GET', 'http://host.com/?a=b&c=d&a=b', '', {})
req3 = request.Request('GET', 'http://host.com:80/?c=d&a=b&a=b', '', {}) req3 = request.Request('GET', 'http://host.com/?c=d&a=b&a=b', '', {})
assert matchers.query(req1, req2) assert matchers.query(req1, req2)
assert matchers.query(req1, req3) assert matchers.query(req1, req3)

View File

@@ -2,13 +2,13 @@ from vcr.request import Request
def test_str(): def test_str():
req = Request('GET', 'http://www.google.com:80/', '', {}) req = Request('GET', 'http://www.google.com/', '', {})
str(req) == '<Request (GET) http://www.google.com:80/>' str(req) == '<Request (GET) http://www.google.com/>'
def test_headers(): def test_headers():
headers = {'X-Header1': ['h1'], 'X-Header2': 'h2'} 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']} assert req.headers == {'X-Header1': ['h1'], 'X-Header2': ['h2']}
req.add_header('X-Header1', 'h11') req.add_header('X-Header1', 'h11')
@@ -17,7 +17,7 @@ def test_headers():
def test_flat_headers_dict(): def test_flat_headers_dict():
headers = {'X-Header1': ['h1', 'h11'], 'X-Header2': ['h2']} 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'} assert req.flat_headers_dict() == {'X-Header1': 'h1', 'X-Header2': 'h2'}