@@ -98,7 +98,7 @@ async def test__get_metadata_error(
9898 quota_project = None ,
9999 credentials = credentials ,
100100 )
101- with pytest .raises (RetryError ) as exc_info :
101+ with pytest .raises (RetryError ):
102102 await client ._get_metadata (
103103 "my-project" , "my-region" , "my-cluster" , "my-instance"
104104 )
@@ -135,11 +135,10 @@ async def test__get_client_certificate_error(
135135 quota_project = None ,
136136 credentials = credentials ,
137137 )
138- with pytest .raises (RetryError ) as exc_info :
138+ with pytest .raises (RetryError ):
139139 await client ._get_client_certificate (
140140 "my-project" , "my-region" , "my-cluster" , ""
141141 )
142- print (exc_info )
143142 await client .close ()
144143
145144
@@ -153,8 +152,7 @@ async def test_AlloyDBClient_init_(credentials: FakeCredentials) -> None:
153152 # verify base endpoint is set
154153 assert client ._client .api_endpoint == "www.test-endpoint.com"
155154 # verify proper headers are set
156- got_user_agent = client ._client .transport ._wrapped_methods [client ._client .transport .list_clusters ]._metadata [0 ][1 ]
157- assert got_user_agent .startswith (f"alloydb-python-connector/{ version } " )
155+ assert client ._user_agent .startswith (f"alloydb-python-connector/{ version } " )
158156 assert client ._client ._client ._client_options .quota_project_id == "my-quota-project"
159157 # close client
160158 await client .close ()
@@ -173,8 +171,7 @@ async def test_AlloyDBClient_init_custom_user_agent(
173171 credentials ,
174172 user_agent = "custom-agent/v1.0.0 other-agent/v2.0.0" ,
175173 )
176- got_user_agent = client ._client .transport ._wrapped_methods [client ._client .transport .list_clusters ]._metadata [0 ][1 ]
177- assert got_user_agent .startswith (f"alloydb-python-connector/{ version } custom-agent/v1.0.0 other-agent/v2.0.0" )
174+ assert client ._user_agent .startswith (f"alloydb-python-connector/{ version } custom-agent/v1.0.0 other-agent/v2.0.0" )
178175 await client .close ()
179176
180177
@@ -193,11 +190,10 @@ async def test_AlloyDBClient_user_agent(
193190 client = AlloyDBClient (
194191 "www.test-endpoint.com" , "my-quota-project" , credentials , driver = driver
195192 )
196- got_user_agent = client ._client .transport ._wrapped_methods [client ._client .transport .list_clusters ]._metadata [0 ][1 ]
197193 if driver is None :
198- assert got_user_agent .startswith (f"alloydb-python-connector/{ version } " )
194+ assert client . _user_agent .startswith (f"alloydb-python-connector/{ version } " )
199195 else :
200- assert got_user_agent .startswith (f"alloydb-python-connector/{ version } +{ driver } " )
196+ assert client . _user_agent .startswith (f"alloydb-python-connector/{ version } +{ driver } " )
201197 # close client
202198 await client .close ()
203199
0 commit comments