Skip to content

Commit f0c1060

Browse files
authored
Allow passing metadata as part of creating a bidi (#7514)
* allows providing rpc metadata for bidi streams
1 parent 1e67c91 commit f0c1060

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/google-cloud-firestore/google/cloud/firestore_v1beta1/watch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ def should_recover(exc): # pragma: NO COVER
213213
ResumableBidiRpc = self.ResumableBidiRpc # FBO unit tests
214214

215215
self._rpc = ResumableBidiRpc(
216-
self._api.transport._stubs["firestore_stub"].Listen,
216+
self._api.transport.listen,
217217
initial_request=initial_request,
218218
should_recover=should_recover,
219+
rpc_metadata=self._firestore._rpc_metadata,
219220
)
220221

221222
self._rpc.add_done_callback(self._on_rpc_done)

packages/google-cloud-firestore/tests/unit/v1beta1/test_cross_language.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,13 @@ def convert_precondition(precond):
342342

343343

344344
class DummyRpc(object): # pragma: NO COVER
345-
def __init__(self, listen, initial_request, should_recover):
345+
def __init__(self, listen, initial_request, should_recover, rpc_metadata=None):
346346
self.listen = listen
347347
self.initial_request = initial_request
348348
self.should_recover = should_recover
349349
self.closed = False
350350
self.callbacks = []
351+
self._rpc_metadata = rpc_metadata
351352

352353
def add_done_callback(self, callback):
353354
self.callbacks.append(callback)

packages/google-cloud-firestore/tests/unit/v1beta1/test_watch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ def _to_protobuf(self):
713713
class DummyFirestore(object):
714714
_firestore_api = DummyFirestoreClient()
715715
_database_string = "abc://bar/"
716+
_rpc_metadata = None
716717

717718
def document(self, *document_path): # pragma: NO COVER
718719
if len(document_path) == 1:
@@ -781,12 +782,13 @@ def Thread(self, name, target, kwargs):
781782

782783

783784
class DummyRpc(object):
784-
def __init__(self, listen, initial_request, should_recover):
785+
def __init__(self, listen, initial_request, should_recover, rpc_metadata=None):
785786
self.listen = listen
786787
self.initial_request = initial_request
787788
self.should_recover = should_recover
788789
self.closed = False
789790
self.callbacks = []
791+
self._rpc_metadata = rpc_metadata
790792

791793
def add_done_callback(self, callback):
792794
self.callbacks.append(callback)

0 commit comments

Comments
 (0)