File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 "for help on authentication with this library."
3434)
3535
36+ # Default timeout for auth requests.
37+ _CREDENTIALS_REFRESH_TIMEOUT = 300
38+
3639
3740class _ClientFactoryMixin (object ):
3841 """Mixin to allow factories that create credentials.
@@ -153,7 +156,8 @@ def _http(self):
153156 """
154157 if self ._http_internal is None :
155158 self ._http_internal = google .auth .transport .requests .AuthorizedSession (
156- self ._credentials
159+ self ._credentials ,
160+ refresh_timeout = _CREDENTIALS_REFRESH_TIMEOUT ,
157161 )
158162 return self ._http_internal
159163
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ def test__http_property_existing(self):
122122 self .assertIs (client ._http , http )
123123
124124 def test__http_property_new (self ):
125+ from google .cloud .client import _CREDENTIALS_REFRESH_TIMEOUT
125126 credentials = _make_credentials ()
126127 client = self ._make_one (credentials = credentials )
127128 self .assertIsNone (client ._http_internal )
@@ -133,7 +134,7 @@ def test__http_property_new(self):
133134 with authorized_session_patch as AuthorizedSession :
134135 self .assertIs (client ._http , mock .sentinel .http )
135136 # Check the mock.
136- AuthorizedSession .assert_called_once_with (credentials )
137+ AuthorizedSession .assert_called_once_with (credentials , refresh_timeout = _CREDENTIALS_REFRESH_TIMEOUT )
137138 # Make sure the cached value is used on subsequent access.
138139 self .assertIs (client ._http_internal , mock .sentinel .http )
139140 self .assertIs (client ._http , mock .sentinel .http )
You can’t perform that action at this time.
0 commit comments