# Path: google/cloud/firestore_v1/types/document.py
# class Document(proto.Message):
# class Value(proto.Message):
# class ArrayValue(proto.Message):
# class MapValue(proto.Message):
# 
# Path: google/cloud/firestore_v1/types/firestore.py
# class GetDocumentRequest(proto.Message):
# class ListDocumentsRequest(proto.Message):
# class ListDocumentsResponse(proto.Message):
# class CreateDocumentRequest(proto.Message):
# class UpdateDocumentRequest(proto.Message):
# class DeleteDocumentRequest(proto.Message):
# class BatchGetDocumentsRequest(proto.Message):
# class BatchGetDocumentsResponse(proto.Message):
# class BeginTransactionRequest(proto.Message):
# class BeginTransactionResponse(proto.Message):
# class CommitRequest(proto.Message):
# class CommitResponse(proto.Message):
# class RollbackRequest(proto.Message):
# class RunQueryRequest(proto.Message):
# class RunQueryResponse(proto.Message):
# class PartitionQueryRequest(proto.Message):
# class PartitionQueryResponse(proto.Message):
# class WriteRequest(proto.Message):
# class WriteResponse(proto.Message):
# class ListenRequest(proto.Message):
# class ListenResponse(proto.Message):
# class Target(proto.Message):
#     class DocumentsTarget(proto.Message):
#     class QueryTarget(proto.Message):
# class TargetChange(proto.Message):
#     class TargetChangeType(proto.Enum):
# class ListCollectionIdsRequest(proto.Message):
# class ListCollectionIdsResponse(proto.Message):
# class BatchWriteRequest(proto.Message):
# class BatchWriteResponse(proto.Message):
#     def raw_page(self):
#     def raw_page(self):
#     def raw_page(self):
#         NO_CHANGE = 0
#         ADD = 1
#         REMOVE = 2
#         CURRENT = 3
#         RESET = 4
# 
# Path: google/cloud/firestore_v1/types/write.py
# class Write(proto.Message):
# class DocumentTransform(proto.Message):
#     class FieldTransform(proto.Message):
#         class ServerValue(proto.Enum):
# class WriteResult(proto.Message):
# class DocumentChange(proto.Message):
# class DocumentDelete(proto.Message):
# class DocumentRemove(proto.Message):
# class ExistenceFilter(proto.Message):
#             SERVER_VALUE_UNSPECIFIED = 0
#             REQUEST_TIME = 1
# 
# Path: tests/unit/v1/conformance_tests.py
# class TestFile(proto.Message):
# class Test(proto.Message):
# class GetTest(proto.Message):
# class CreateTest(proto.Message):
# class SetTest(proto.Message):
# class UpdateTest(proto.Message):
# class UpdatePathsTest(proto.Message):
# class DeleteTest(proto.Message):
# class SetOption(proto.Message):
# class QueryTest(proto.Message):
# class Clause(proto.Message):
# class Select(proto.Message):
# class Where(proto.Message):
# class OrderBy(proto.Message):
# class Cursor_(proto.Message):
# class DocSnapshot(proto.Message):
# class FieldPath(proto.Message):
# class ListenTest(proto.Message):
# class Snapshot(proto.Message):
# class DocChange(proto.Message):
#     class Kind(proto.Enum):
#         KIND_UNSPECIFIED = 0
#         ADDED = 1
#         REMOVED = 2
#         MODIFIED = 3


import functools
import glob
import json
import os
import mock
import pytest
    import google.auth.credentials
    import google.auth.credentials
from google.cloud.firestore_v1.types import document
from google.cloud.firestore_v1.types import firestore
from google.cloud.firestore_v1.types import write
from google.protobuf.timestamp_pb2 import Timestamp
from tests.unit.v1 import conformance_tests
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1.client import DEFAULT_DATABASE
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1 import DocumentSnapshot
    from google.cloud.firestore_v1 import Watch
    from google.cloud.firestore_v1 import ArrayRemove
    from google.cloud.firestore_v1 import ArrayUnion
    from google.cloud.firestore_v1 import DELETE_FIELD
    from google.cloud.firestore_v1 import SERVER_TIMESTAMP
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import Client
        from google.cloud.firestore_v1.types import query
    from google.auth.credentials import Credentials
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1 import Query
    from google.cloud.firestore_v1 import DocumentReference
    from google.cloud.firestore_v1 import DocumentSnapshot
            write.Write.wrap(write_pb) for write_pb in testcase.request.writes
        ]

        expected_request = {
            "database": client._database_string,
            "writes": wrapped_writes,
            "transaction": None,
        }

        firestore_api.commit.assert_called_once_with(
            request=expected_request, metadata=client._rpc_metadata,
        )


@pytest.mark.parametrize("test_proto", _CREATE_TESTPROTOS)
def test_create_testprotos(test_proto):
    testcase = test_proto.create
    firestore_api = _mock_firestore_api()
    client, doc = _make_client_document(firestore_api, testcase)
    data = convert_data(json.loads(testcase.json_data))
    call = functools.partial(doc.create, data)
    _run_testcase(testcase, call, firestore_api, client)


@pytest.mark.parametrize("test_proto", _GET_TESTPROTOS)
def test_get_testprotos(test_proto):
    testcase = test_proto.get
    firestore_api = mock.Mock(spec=["batch_get_documents", "_client"])
    response = firestore.BatchGetDocumentsResponse()
    response.read_time = Timestamp(seconds=0, nanos=0)

# Path: google/cloud/firestore_v1/types/document.py
# class Document(proto.Message):
# class Value(proto.Message):
# class ArrayValue(proto.Message):
# class MapValue(proto.Message):
# 
# Path: google/cloud/firestore_v1/types/firestore.py
# class GetDocumentRequest(proto.Message):
# class ListDocumentsRequest(proto.Message):
# class ListDocumentsResponse(proto.Message):
# class CreateDocumentRequest(proto.Message):
# class UpdateDocumentRequest(proto.Message):
# class DeleteDocumentRequest(proto.Message):
# class BatchGetDocumentsRequest(proto.Message):
# class BatchGetDocumentsResponse(proto.Message):
# class BeginTransactionRequest(proto.Message):
# class BeginTransactionResponse(proto.Message):
# class CommitRequest(proto.Message):
# class CommitResponse(proto.Message):
# class RollbackRequest(proto.Message):
# class RunQueryRequest(proto.Message):
# class RunQueryResponse(proto.Message):
# class PartitionQueryRequest(proto.Message):
# class PartitionQueryResponse(proto.Message):
# class WriteRequest(proto.Message):
# class WriteResponse(proto.Message):
# class ListenRequest(proto.Message):
# class ListenResponse(proto.Message):
# class Target(proto.Message):
#     class DocumentsTarget(proto.Message):
#     class QueryTarget(proto.Message):
# class TargetChange(proto.Message):
#     class TargetChangeType(proto.Enum):
# class ListCollectionIdsRequest(proto.Message):
# class ListCollectionIdsResponse(proto.Message):
# class BatchWriteRequest(proto.Message):
# class BatchWriteResponse(proto.Message):
#     def raw_page(self):
#     def raw_page(self):
#     def raw_page(self):
#         NO_CHANGE = 0
#         ADD = 1
#         REMOVE = 2
#         CURRENT = 3
#         RESET = 4
# 
# Path: google/cloud/firestore_v1/types/write.py
# class Write(proto.Message):
# class DocumentTransform(proto.Message):
#     class FieldTransform(proto.Message):
#         class ServerValue(proto.Enum):
# class WriteResult(proto.Message):
# class DocumentChange(proto.Message):
# class DocumentDelete(proto.Message):
# class DocumentRemove(proto.Message):
# class ExistenceFilter(proto.Message):
#             SERVER_VALUE_UNSPECIFIED = 0
#             REQUEST_TIME = 1
# 
# Path: tests/unit/v1/conformance_tests.py
# class TestFile(proto.Message):
# class Test(proto.Message):
# class GetTest(proto.Message):
# class CreateTest(proto.Message):
# class SetTest(proto.Message):
# class UpdateTest(proto.Message):
# class UpdatePathsTest(proto.Message):
# class DeleteTest(proto.Message):
# class SetOption(proto.Message):
# class QueryTest(proto.Message):
# class Clause(proto.Message):
# class Select(proto.Message):
# class Where(proto.Message):
# class OrderBy(proto.Message):
# class Cursor_(proto.Message):
# class DocSnapshot(proto.Message):
# class FieldPath(proto.Message):
# class ListenTest(proto.Message):
# class Snapshot(proto.Message):
# class DocChange(proto.Message):
#     class Kind(proto.Enum):
#         KIND_UNSPECIFIED = 0
#         ADDED = 1
#         REMOVED = 2
#         MODIFIED = 3


# Path: tests/unit/v1/test_cross_language.py
import functools
import glob
import json
import os
import mock
import pytest
    import google.auth.credentials
    import google.auth.credentials
from google.cloud.firestore_v1.types import document
from google.cloud.firestore_v1.types import firestore
from google.cloud.firestore_v1.types import write
from google.protobuf.timestamp_pb2 import Timestamp
from tests.unit.v1 import conformance_tests
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1.client import DEFAULT_DATABASE
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1 import DocumentSnapshot
    from google.cloud.firestore_v1 import Watch
    from google.cloud.firestore_v1 import ArrayRemove
    from google.cloud.firestore_v1 import ArrayUnion
    from google.cloud.firestore_v1 import DELETE_FIELD
    from google.cloud.firestore_v1 import SERVER_TIMESTAMP
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import Client
        from google.cloud.firestore_v1.types import query
    from google.auth.credentials import Credentials
    from google.cloud.firestore_v1 import Client
    from google.cloud.firestore_v1 import Query
    from google.cloud.firestore_v1 import DocumentReference
    from google.cloud.firestore_v1 import DocumentSnapshot

            write.Write.wrap(write_pb) for write_pb in testcase.request.writes
        ]

        expected_request = {
            "database": client._database_string,
            "writes": wrapped_writes,
            "transaction": None,
        }

        firestore_api.commit.assert_called_once_with(
            request=expected_request, metadata=client._rpc_metadata,
        )


@pytest.mark.parametrize("test_proto", _CREATE_TESTPROTOS)
def test_create_testprotos(test_proto):
    testcase = test_proto.create
    firestore_api = _mock_firestore_api()
    client, doc = _make_client_document(firestore_api, testcase)
    data = convert_data(json.loads(testcase.json_data))
    call = functools.partial(doc.create, data)
    _run_testcase(testcase, call, firestore_api, client)


@pytest.mark.parametrize("test_proto", _GET_TESTPROTOS)
def test_get_testprotos(test_proto):
    testcase = test_proto.get
    firestore_api = mock.Mock(spec=["batch_get_documents", "_client"])
    response = firestore.BatchGetDocumentsResponse()
    response.read_time = Timestamp(seconds=0, nanos=0)

    response.found = document.Document()