2222 _merge_request_options ,
2323)
2424from google .cloud .spanner_v1 .types import (
25- ClientContext ,
2625 ExecuteSqlRequest ,
2726 RequestOptions ,
2827)
@@ -33,23 +32,23 @@ def test__merge_client_context_both_none(self):
3332 self .assertIsNone (_merge_client_context (None , None ))
3433
3534 def test__merge_client_context_base_none (self ):
36- merge = ClientContext (secure_context = {"a" : struct_pb2 .Value (string_value = "A" )})
35+ merge = RequestOptions . ClientContext (secure_context = {"a" : struct_pb2 .Value (string_value = "A" )})
3736 result = _merge_client_context (None , merge )
3837 self .assertEqual (result .secure_context ["a" ], "A" )
3938
4039 def test__merge_client_context_merge_none (self ):
41- base = ClientContext (secure_context = {"a" : struct_pb2 .Value (string_value = "A" )})
40+ base = RequestOptions . ClientContext (secure_context = {"a" : struct_pb2 .Value (string_value = "A" )})
4241 result = _merge_client_context (base , None )
4342 self .assertEqual (result .secure_context ["a" ], "A" )
4443
4544 def test__merge_client_context_both_set (self ):
46- base = ClientContext (
45+ base = RequestOptions . ClientContext (
4746 secure_context = {
4847 "a" : struct_pb2 .Value (string_value = "A" ),
4948 "b" : struct_pb2 .Value (string_value = "B1" ),
5049 }
5150 )
52- merge = ClientContext (
51+ merge = RequestOptions . ClientContext (
5352 secure_context = {
5453 "b" : struct_pb2 .Value (string_value = "B2" ),
5554 "c" : struct_pb2 .Value (string_value = "C" ),
@@ -62,7 +61,7 @@ def test__merge_client_context_both_set(self):
6261
6362 def test__merge_request_options_with_client_context (self ):
6463 request_options = RequestOptions (priority = RequestOptions .Priority .PRIORITY_LOW )
65- client_context = ClientContext (
64+ client_context = RequestOptions . ClientContext (
6665 secure_context = {"a" : struct_pb2 .Value (string_value = "A" )}
6766 )
6867
@@ -91,7 +90,7 @@ def test_client_init_with_client_context(self):
9190 disable_builtin_metrics = True ,
9291 )
9392
94- self .assertIsInstance (client ._client_context , ClientContext )
93+ self .assertIsInstance (client ._client_context , RequestOptions . ClientContext )
9594 self .assertEqual (client ._client_context .secure_context ["a" ], "A" )
9695
9796 def test_snapshot_execute_sql_propagates_client_context (self ):
@@ -106,11 +105,11 @@ def test_snapshot_execute_sql_propagates_client_context(self):
106105
107106 client = database ._instance ._client = mock .Mock ()
108107 client ._query_options = None
109- client ._client_context = ClientContext (
108+ client ._client_context = RequestOptions . ClientContext (
110109 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
111110 )
112111
113- snapshot_context = ClientContext (
112+ snapshot_context = RequestOptions . ClientContext (
114113 secure_context = {"snapshot" : struct_pb2 .Value (string_value = "from-snapshot" )}
115114 )
116115 snapshot = Snapshot (session , client_context = snapshot_context )
@@ -148,11 +147,11 @@ def test_transaction_commit_propagates_client_context(self):
148147 database ._next_nth_request = 1
149148
150149 client = database ._instance ._client = mock .Mock ()
151- client ._client_context = ClientContext (
150+ client ._client_context = RequestOptions . ClientContext (
152151 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
153152 )
154153
155- transaction_context = ClientContext (
154+ transaction_context = RequestOptions . ClientContext (
156155 secure_context = {"txn" : struct_pb2 .Value (string_value = "from-txn" )}
157156 )
158157 transaction = Transaction (session , client_context = transaction_context )
@@ -196,11 +195,11 @@ def test_snapshot_execute_sql_request_level_override(self):
196195
197196 client = database ._instance ._client = mock .Mock ()
198197 client ._query_options = None
199- client ._client_context = ClientContext (
198+ client ._client_context = RequestOptions . ClientContext (
200199 secure_context = {"a" : struct_pb2 .Value (string_value = "from-client" )}
201200 )
202201
203- snapshot_context = ClientContext (
202+ snapshot_context = RequestOptions . ClientContext (
204203 secure_context = {
205204 "a" : struct_pb2 .Value (string_value = "from-snapshot" ),
206205 "b" : struct_pb2 .Value (string_value = "B" ),
@@ -209,7 +208,7 @@ def test_snapshot_execute_sql_request_level_override(self):
209208 snapshot = Snapshot (session , client_context = snapshot_context )
210209
211210 request_options = RequestOptions (
212- client_context = ClientContext (
211+ client_context = RequestOptions . ClientContext (
213212 secure_context = {"a" : struct_pb2 .Value (string_value = "from-request" )}
214213 )
215214 )
@@ -241,11 +240,11 @@ def test_batch_commit_propagates_client_context(self):
241240 database .with_error_augmentation .return_value = (None , mock .MagicMock ())
242241 database ._next_nth_request = 1
243242 client = database ._instance ._client = mock .Mock ()
244- client ._client_context = ClientContext (
243+ client ._client_context = RequestOptions . ClientContext (
245244 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
246245 )
247246
248- batch_context = ClientContext (
247+ batch_context = RequestOptions . ClientContext (
249248 secure_context = {"batch" : struct_pb2 .Value (string_value = "from-batch" )}
250249 )
251250 batch = Batch (session , client_context = batch_context )
@@ -285,11 +284,11 @@ def test_transaction_execute_update_propagates_client_context(self):
285284
286285 client = database ._instance ._client = mock .Mock ()
287286 client ._query_options = None
288- client ._client_context = ClientContext (
287+ client ._client_context = RequestOptions . ClientContext (
289288 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
290289 )
291290
292- transaction_context = ClientContext (
291+ transaction_context = RequestOptions . ClientContext (
293292 secure_context = {"txn" : struct_pb2 .Value (string_value = "from-txn" )}
294293 )
295294 transaction = Transaction (session , client_context = transaction_context )
@@ -329,11 +328,11 @@ def test_mutation_groups_batch_write_propagates_client_context(self):
329328 database ._next_nth_request = 1
330329
331330 client = database ._instance ._client = mock .Mock ()
332- client ._client_context = ClientContext (
331+ client ._client_context = RequestOptions . ClientContext (
333332 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
334333 )
335334
336- mg_context = ClientContext (
335+ mg_context = RequestOptions . ClientContext (
337336 secure_context = {"mg" : struct_pb2 .Value (string_value = "from-mg" )}
338337 )
339338 mg = MutationGroups (session , client_context = mg_context )
@@ -363,11 +362,11 @@ def test_batch_snapshot_propagates_client_context(self):
363362 database .name = "database-name"
364363 client = database ._instance ._client = mock .Mock ()
365364 client ._query_options = None
366- client ._client_context = ClientContext (
365+ client ._client_context = RequestOptions . ClientContext (
367366 secure_context = {"client" : struct_pb2 .Value (string_value = "from-client" )}
368367 )
369368
370- batch_context = ClientContext (
369+ batch_context = RequestOptions . ClientContext (
371370 secure_context = {"batch" : struct_pb2 .Value (string_value = "from-batch" )}
372371 )
373372 batch_snapshot = BatchSnapshot (database , client_context = batch_context )
0 commit comments