Add string representation to _RequestObjectProxy
Via https://github.com/openstack/requests-mock/pull/12 by @allardhoeve Change-Id: I7e9bba3a22a08ee41af5480b8a3cee49ef06624d
This commit is contained in:
parent
aa3e87c4ee
commit
fcc640f495
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,6 +34,7 @@ htmlcov
|
||||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
.idea
|
||||
|
||||
# Complexity
|
||||
output/*.html
|
||||
|
@ -152,3 +152,6 @@ class _RequestObjectProxy(object):
|
||||
the matcher is not available it will return None.
|
||||
"""
|
||||
return self._matcher()
|
||||
|
||||
def __str__(self):
|
||||
return "{0.method} {0.url}".format(self._request)
|
||||
|
@ -117,3 +117,7 @@ class RequestTests(base.TestCase):
|
||||
self.assertEqual('host.example.com', req.netloc)
|
||||
self.assertEqual('host.example.com', req.hostname)
|
||||
self.assertEqual(443, req.port)
|
||||
|
||||
def test_to_string(self):
|
||||
req = self.do_request(url='https://host.example.com/path')
|
||||
self.assertEqual('GET https://host.example.com/path', str(req))
|
||||
|
Loading…
x
Reference in New Issue
Block a user