@@ -1806,7 +1806,6 @@ def test_update_dataset(self):
18061806 "access" : ACCESS ,
18071807 },
18081808 path = "/" + PATH ,
1809- headers = None ,
18101809 timeout = 7.5 ,
18111810 )
18121811 self .assertEqual (ds2 .description , ds .description )
@@ -1850,7 +1849,6 @@ def test_update_dataset_w_custom_property(self):
18501849 method = "PATCH" ,
18511850 data = {"newAlphaProperty" : "unreleased property" },
18521851 path = path ,
1853- headers = None ,
18541852 timeout = DEFAULT_TIMEOUT ,
18551853 )
18561854
@@ -1909,7 +1907,7 @@ def test_update_model(self):
19091907 "labels" : {"x" : "y" },
19101908 }
19111909 conn .api_request .assert_called_once_with (
1912- method = "PATCH" , data = sent , path = "/" + path , headers = None , timeout = 7.5
1910+ method = "PATCH" , data = sent , path = "/" + path , timeout = 7.5
19131911 )
19141912 self .assertEqual (updated_model .model_id , model .model_id )
19151913 self .assertEqual (updated_model .description , model .description )
@@ -1982,7 +1980,6 @@ def test_update_routine(self):
19821980 method = "PUT" ,
19831981 data = sent ,
19841982 path = "/projects/routines-project/datasets/test_routines/routines/updated_routine" ,
1985- headers = None ,
19861983 timeout = 7.5 ,
19871984 )
19881985 self .assertEqual (actual_routine .arguments , routine .arguments )
@@ -2090,7 +2087,7 @@ def test_update_table(self):
20902087 "labels" : {"x" : "y" },
20912088 }
20922089 conn .api_request .assert_called_once_with (
2093- method = "PATCH" , data = sent , path = "/" + path , headers = None , timeout = 7.5
2090+ method = "PATCH" , data = sent , path = "/" + path , timeout = 7.5
20942091 )
20952092 self .assertEqual (updated_table .description , table .description )
20962093 self .assertEqual (updated_table .friendly_name , table .friendly_name )
@@ -2140,7 +2137,6 @@ def test_update_table_w_custom_property(self):
21402137 method = "PATCH" ,
21412138 path = "/%s" % path ,
21422139 data = {"newAlphaProperty" : "unreleased property" },
2143- headers = None ,
21442140 timeout = DEFAULT_TIMEOUT ,
21452141 )
21462142 self .assertEqual (
@@ -2175,7 +2171,6 @@ def test_update_table_only_use_legacy_sql(self):
21752171 method = "PATCH" ,
21762172 path = "/%s" % path ,
21772173 data = {"view" : {"useLegacySql" : True }},
2178- headers = None ,
21792174 timeout = DEFAULT_TIMEOUT ,
21802175 )
21812176 self .assertEqual (updated_table .view_use_legacy_sql , table .view_use_legacy_sql )
@@ -2273,7 +2268,6 @@ def test_update_table_w_query(self):
22732268 "expirationTime" : str (_millis (exp_time )),
22742269 "schema" : schema_resource ,
22752270 },
2276- headers = None ,
22772271 timeout = DEFAULT_TIMEOUT ,
22782272 )
22792273
@@ -8173,3 +8167,20 @@ def transmit_next_chunk(transport):
81738167
81748168 chunk_size = RU .call_args_list [0 ][0 ][1 ]
81758169 assert chunk_size == 100 * (1 << 20 )
8170+
8171+
8172+ @pytest .mark .enable_add_server_timeout_header
8173+ @pytest .mark .parametrize ("headers" , [None , {}])
8174+ def test__call_api_add_server_timeout_w_timeout (client , headers ):
8175+ client ._connection = make_connection ({})
8176+ client ._call_api (None , method = "GET" , path = "/" , headers = headers , timeout = 42 )
8177+ client ._connection .api_request .assert_called_with (
8178+ method = "GET" , path = "/" , timeout = 42 , headers = {"X-Server-Timeout" : "42" }
8179+ )
8180+
8181+
8182+ @pytest .mark .enable_add_server_timeout_header
8183+ def test__call_api_no_add_server_timeout_wo_timeout (client ):
8184+ client ._connection = make_connection ({})
8185+ client ._call_api (None , method = "GET" , path = "/" )
8186+ client ._connection .api_request .assert_called_with (method = "GET" , path = "/" )
0 commit comments