Skip to content

Commit

Permalink
Merge branch 'main' into owl-bot-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Jul 5, 2023
2 parents d9b70a8 + 8ce3c1a commit a735237
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/unit/v1/test_cross_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import mock
import pytest

import proto as proto_plus

from google.cloud.firestore_v1.types import document
from google.cloud.firestore_v1.types import firestore
from google.cloud.firestore_v1.types import write
Expand Down Expand Up @@ -244,7 +246,10 @@ def callback(keys, applied_changes, read_time):
watch = Watch.for_query(query, callback, DocumentSnapshot)

wrapped_responses = [
firestore.ListenResponse.wrap(proto) for proto in testcase.responses
firestore.ListenResponse.wrap(proto._pb)
if isinstance(proto, proto_plus.Message)
else firestore.ListenResponse.wrap(proto)
for proto in testcase.responses
]
if testcase.is_error:
try:
Expand Down Expand Up @@ -336,10 +341,15 @@ def convert_set_option(option):
def convert_precondition(precond):
from google.cloud.firestore_v1 import Client

if precond.HasField("exists"):
if isinstance(precond, proto_plus.Message):
precond_pb = precond._pb
else:
precond_pb = precond

if precond_pb.HasField("exists"):
return Client.write_option(exists=precond.exists)

assert precond.HasField("update_time")
assert precond_pb.HasField("update_time")
return Client.write_option(last_update_time=precond.update_time)


Expand Down

0 comments on commit a735237

Please sign in to comment.