コード例 #1
0
    def test_it(self):
        from google.cloud.firestore_v1beta1.client import Client

        credentials = _make_credentials()
        client = Client(project='hi-projject', credentials=credentials)

        reference1 = client.document('a', 'b')
        reference2 = client.document('a', 'b', 'c', 'd')
        reference3 = client.document('a', 'b')
        reference4 = client.document('f', 'g')

        doc_path1 = reference1._document_path
        doc_path2 = reference2._document_path
        doc_path3 = reference3._document_path
        doc_path4 = reference4._document_path
        self.assertEqual(doc_path1, doc_path3)

        document_paths, reference_map = self._call_fut(
            [reference1, reference2, reference3, reference4])
        self.assertEqual(
            document_paths, [doc_path1, doc_path2, doc_path3, doc_path4])
        # reference3 over-rides reference1.
        expected_map = {
            doc_path2: reference2,
            doc_path3: reference3,
            doc_path4: reference4,
        }
        self.assertEqual(reference_map, expected_map)
コード例 #2
0
    def test_it(self):
        from google.cloud.firestore_v1beta1.client import Client

        credentials = _make_credentials()
        client = Client(project="hi-projject", credentials=credentials)

        reference1 = client.document("a", "b")
        reference2 = client.document("a", "b", "c", "d")
        reference3 = client.document("a", "b")
        reference4 = client.document("f", "g")

        doc_path1 = reference1._document_path
        doc_path2 = reference2._document_path
        doc_path3 = reference3._document_path
        doc_path4 = reference4._document_path
        self.assertEqual(doc_path1, doc_path3)

        document_paths, reference_map = self._call_fut(
            [reference1, reference2, reference3, reference4]
        )
        self.assertEqual(document_paths, [doc_path1, doc_path2, doc_path3, doc_path4])
        # reference3 over-rides reference1.
        expected_map = {
            doc_path2: reference2,
            doc_path3: reference3,
            doc_path4: reference4,
        }
        self.assertEqual(reference_map, expected_map)
コード例 #3
0
def _make_client(project="project-project"):
    from google.cloud.firestore_v1beta1.client import Client

    credentials = _make_credentials()

    with pytest.deprecated_call():
        return Client(project=project, credentials=credentials)
コード例 #4
0
def _make_client(project='feral-tom-cat'):
    from google.cloud.firestore_v1beta1.client import Client

    credentials = _make_credentials()
    return Client(project=project, credentials=credentials)
コード例 #5
0
def _make_client():
    from google.cloud.firestore_v1beta1.client import Client

    credentials = _make_credentials()
    return Client(project="project-project", credentials=credentials)
コード例 #6
0
def _make_client(project='seventy-nine'):
    from google.cloud.firestore_v1beta1.client import Client

    credentials = _make_credentials()
    return Client(project=project, credentials=credentials)