Skip to content

feat: add close method #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google_auth_httplib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def __init__(
# credentials.refresh).
self._request = Request(self.http)

def close(self):
"""Calls httplib2's Http.close"""
self.http.close()

def request(
self,
uri,
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

from setuptools import setup


version = "0.0.4"

DEPENDENCIES = ["google-auth", "httplib2 >= 0.9.1", "six"]
DEPENDENCIES = ["google-auth", "httplib2 >= 0.15.0", "six"]


with io.open("README.rst", "r") as fh:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_google_auth_httplib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ def test_authed_http_defaults(self):
assert authed_http.credentials == mock.sentinel.credentials
assert isinstance(authed_http.http, httplib2.Http)

def test_close(self):
with mock.patch("httplib2.Http.close", autospec=True) as close:
authed_http = google_auth_httplib2.AuthorizedHttp(mock.sentinel.credentials)
authed_http.close()

close.assert_called_once()

def test_connections(self):
authed_http = google_auth_httplib2.AuthorizedHttp(mock.sentinel.credentials)

Expand Down