Docstring pass after pep8ify in tests/
This commit is contained in:
@@ -24,7 +24,8 @@ class HttpMock(object):
|
||||
"""Mock of httplib2.Http"""
|
||||
|
||||
def __init__(self, filename=None, headers=None):
|
||||
"""
|
||||
"""HttpMock constructor.
|
||||
|
||||
Args:
|
||||
filename: string, absolute filename to read response from
|
||||
headers: dict, header to return with response
|
||||
@@ -62,7 +63,7 @@ class HttpMockSequence(object):
|
||||
|
||||
Mocks a sequence of calls to request returning different responses for each
|
||||
call. Create an instance initialized with the desired response headers
|
||||
and content and then use as if an httplib2.Http instance.
|
||||
and content and then use as if an httplib2.Http instance::
|
||||
|
||||
http = HttpMockSequence([
|
||||
({'status': '401'}, b''),
|
||||
@@ -74,15 +75,17 @@ class HttpMockSequence(object):
|
||||
There are special values you can pass in for content to trigger
|
||||
behavours that are helpful in testing.
|
||||
|
||||
'echo_request_headers' means return the request headers in the response body
|
||||
'echo_request_headers_as_json' means return the request headers in
|
||||
* 'echo_request_headers' means return the request headers in the response
|
||||
body
|
||||
* 'echo_request_headers_as_json' means return the request headers in
|
||||
the response body
|
||||
'echo_request_body' means return the request body in the response body
|
||||
'echo_request_uri' means return the request uri in the response body
|
||||
* 'echo_request_body' means return the request body in the response body
|
||||
* 'echo_request_uri' means return the request uri in the response body
|
||||
"""
|
||||
|
||||
def __init__(self, iterable):
|
||||
"""
|
||||
"""HttpMockSequence constructor.
|
||||
|
||||
Args:
|
||||
iterable: iterable, a sequence of pairs of (headers, body)
|
||||
"""
|
||||
|
||||
@@ -677,15 +677,15 @@ class BasicCredentialsTests(unittest.TestCase):
|
||||
self.assertEqual(token_response, self.credentials.token_response)
|
||||
|
||||
def test_recursive_authorize(self):
|
||||
"""Tests that OAuth2Credentials does not introduce new method constraints.
|
||||
"""Tests that OAuth2Credentials doesn't intro. new method constraints.
|
||||
|
||||
Formerly, OAuth2Credentials.authorize monkeypatched the request method of
|
||||
its httplib2.Http argument with a wrapper annotated with
|
||||
@util.positional(1). Since the original method has no such annotation, that
|
||||
meant that the wrapper was violating the contract of the original method by
|
||||
adding a new requirement to it. And in fact the wrapper itself doesn't
|
||||
even respect that requirement. So before the removal of the annotation, this
|
||||
test would fail.
|
||||
Formerly, OAuth2Credentials.authorize monkeypatched the request method
|
||||
of its httplib2.Http argument with a wrapper annotated with
|
||||
@util.positional(1). Since the original method has no such annotation,
|
||||
that meant that the wrapper was violating the contract of the original
|
||||
method by adding a new requirement to it. And in fact the wrapper
|
||||
itself doesn't even respect that requirement. So before the removal of
|
||||
the annotation, this test would fail.
|
||||
"""
|
||||
token_response = {'access_token': '1/3w', 'expires_in': 3600}
|
||||
encoded_response = json.dumps(token_response).encode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user