Skip to content

Commit

Permalink
feat: add close method (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored Mar 1, 2021
1 parent 02fb2a1 commit feda187
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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

0 comments on commit feda187

Please sign in to comment.