File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -1361,7 +1361,7 @@ def close(self):
1361
1361
# httplib2 leaves sockets open by default.
1362
1362
# Cleanup using the `close` method.
1363
1363
# https://github.com/httplib2/httplib2/issues/148
1364
- self ._http .http . close ()
1364
+ self ._http .close ()
1365
1365
1366
1366
def _set_service_methods (self ):
1367
1367
self ._add_basic_methods (self ._resourceDesc , self ._rootDesc , self ._schema )
Original file line number Diff line number Diff line change 34
34
install_requires = [
35
35
"httplib2>=0.15.0,<1dev" ,
36
36
"google-auth>=1.16.0,<2dev" ,
37
- "google-auth-httplib2>=0.0.3 " ,
37
+ "google-auth-httplib2>=0.1.0 " ,
38
38
"google-api-core>=1.21.0,<2dev" ,
39
39
"six>=1.13.0,<2dev" ,
40
40
"uritemplate>=3.0.0,<4dev" ,
Original file line number Diff line number Diff line change 87
87
from oauth2client import GOOGLE_TOKEN_URI
88
88
from oauth2client .client import OAuth2Credentials , GoogleCredentials
89
89
90
+
90
91
from googleapiclient import _helpers as util
91
92
92
93
import uritemplate
@@ -591,14 +592,27 @@ def test_building_with_context_manager(self):
591
592
592
593
def test_resource_close (self ):
593
594
discovery = read_datafile ("plus.json" )
594
- with mock .patch ("httplib2.Http" ) as http :
595
+
596
+ with mock .patch ("httplib2.Http" , autospec = True ) as httplib2_http :
597
+ http = httplib2_http ()
598
+ plus = build_from_document (
599
+ discovery ,
600
+ base = "https://www.googleapis.com/" ,
601
+ http = http ,
602
+ )
603
+ plus .close ()
604
+ http .close .assert_called_once ()
605
+
606
+ def test_resource_close_authorized_http (self ):
607
+ discovery = read_datafile ("plus.json" )
608
+ with mock .patch ("google_auth_httplib2.AuthorizedHttp" , autospec = True ):
595
609
plus = build_from_document (
596
610
discovery ,
597
611
base = "https://www.googleapis.com/" ,
598
612
credentials = self .MOCK_CREDENTIALS ,
599
613
)
600
614
plus .close ()
601
- plus ._http .http . close .assert_called_once ()
615
+ plus ._http .close .assert_called_once ()
602
616
603
617
def test_api_endpoint_override_from_client_options (self ):
604
618
discovery = read_datafile ("plus.json" )
You can’t perform that action at this time.
0 commit comments