1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 17:45:35 +00:00

lets make url the actual url instead of just the path

This commit is contained in:
Kevin McCarthy
2013-08-10 13:09:35 -10:00
parent a50cebaf21
commit 59567a26cc
4 changed files with 32 additions and 28 deletions

View File

@@ -49,7 +49,7 @@ class Cassette(object):
self.play_counts[request] += 1
def append(self, request, response):
'''Add a pair of request, response to this cassette'''
'''Add a request, response pair to this cassette'''
self.data[request] = response
def response_of(self, request):
@@ -63,7 +63,7 @@ class Cassette(object):
return "<Cassette containing {0} recorded response(s)>".format(len(self))
def __len__(self):
'''Return the number of request / response pairs stored in here'''
'''Return the number of request,response pairs stored in here'''
return len(self.data)
def __contains__(self, request):

View File

@@ -1,15 +1,19 @@
class Request(object):
def __init__(self, host, port, method, url, body, headers):
def __init__(self, host, port, method, path, body, headers):
self.host = host
self.port = port
self.method = method
self.url = url
self.path = path
self.body = body
self.headers = frozenset(headers.items())
@property
def url(self):
return self.host + self.path
def __key(self):
return (self.host, self.port, self.method, self.url, self.body, self.headers)
return (self.host, self.port, self.method, self.path, self.body, self.headers)
def __hash__(self):
return hash(self.__key())

View File

@@ -50,7 +50,7 @@ class VCRConnectionMixin:
host = self.host,
port = self.port,
method = method,
url = url,
path = url,
body = body,
headers = headers or {}
)