From d840beceafacd37a6abf993cd1fb8039eb3b6864 Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 2 Dec 2016 14:27:18 -0800 Subject: [PATCH] Add proxy to httplib2.Http.connections (#91) --- httplib2_transport/google_auth_httplib2.py | 10 ++++++++++ httplib2_transport/setup.py | 2 +- httplib2_transport/tests/test_google_auth_httplib2.py | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/httplib2_transport/google_auth_httplib2.py b/httplib2_transport/google_auth_httplib2.py index 598ccb3e4..866841b2e 100644 --- a/httplib2_transport/google_auth_httplib2.py +++ b/httplib2_transport/google_auth_httplib2.py @@ -223,3 +223,13 @@ def request(self, uri, method='GET', body=None, headers=None, **kwargs) return response, content + + @property + def connections(self): + """Proxy to httplib2.Http.connections.""" + return self.http.connections + + @connections.setter + def connections(self, value): + """Proxy to httplib2.Http.connections.""" + self.http.connections = value diff --git a/httplib2_transport/setup.py b/httplib2_transport/setup.py index 110cce847..e85c309e7 100644 --- a/httplib2_transport/setup.py +++ b/httplib2_transport/setup.py @@ -30,7 +30,7 @@ setup( name='google-auth-httplib2', - version='0.0.1', + version='0.0.2', author='Google Cloud Platform', author_email='jonwayne+google-auth@google.com', description='Google Authentication Library', diff --git a/httplib2_transport/tests/test_google_auth_httplib2.py b/httplib2_transport/tests/test_google_auth_httplib2.py index 9c2da7080..635965f56 100644 --- a/httplib2_transport/tests/test_google_auth_httplib2.py +++ b/httplib2_transport/tests/test_google_auth_httplib2.py @@ -86,6 +86,15 @@ def test_authed_http_defaults(self): assert authed_http.credentials == mock.sentinel.credentials assert isinstance(authed_http.http, httplib2.Http) + def test_connections(self): + authed_http = google_auth_httplib2.AuthorizedHttp( + mock.sentinel.credentials) + + assert authed_http.connections == authed_http.http.connections + + authed_http.connections = mock.sentinel.connections + assert authed_http.http.connections == mock.sentinel.connections + def test_request_no_refresh(self): mock_credentials = mock.Mock(wraps=MockCredentials()) mock_response = MockResponse()