[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore: Add missing transforms to 'google.cloud.firestore' shim. #8481

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add missing transforms to 'google.cloud.firestore' shim.
Add a unit test that asserts the shim stays in sync with
'google.cloud.firestore_v1'.

Closes #8173.
  • Loading branch information
tseaver committed Jul 2, 2019
commit bfc125258be17c0ff435a0dc6704bc9ccca14645
10 changes: 10 additions & 0 deletions firestore/google/cloud/firestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@


from google.cloud.firestore_v1 import __version__
from google.cloud.firestore_v1 import ArrayRemove
from google.cloud.firestore_v1 import ArrayUnion
from google.cloud.firestore_v1 import Client
from google.cloud.firestore_v1 import CollectionReference
from google.cloud.firestore_v1 import DELETE_FIELD
Expand All @@ -24,7 +26,10 @@
from google.cloud.firestore_v1 import enums
from google.cloud.firestore_v1 import ExistsOption
from google.cloud.firestore_v1 import GeoPoint
from google.cloud.firestore_v1 import Increment
from google.cloud.firestore_v1 import LastUpdateOption
from google.cloud.firestore_v1 import Maximum
from google.cloud.firestore_v1 import Minimum
from google.cloud.firestore_v1 import Query
from google.cloud.firestore_v1 import ReadAfterWriteError
from google.cloud.firestore_v1 import SERVER_TIMESTAMP
Expand All @@ -38,6 +43,8 @@

__all__ = [
"__version__",
"ArrayRemove",
"ArrayUnion",
"Client",
"CollectionReference",
"DELETE_FIELD",
Expand All @@ -46,7 +53,10 @@
"enums",
"ExistsOption",
"GeoPoint",
"Increment",
"LastUpdateOption",
"Maximum",
"Minimum",
"Query",
"ReadAfterWriteError",
"SERVER_TIMESTAMP",
Expand Down
29 changes: 29 additions & 0 deletions firestore/tests/unit/test_firestore_shim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest


class TestFirestoreShim(unittest.TestCase):
def test_shim_matches_firestore_v1(self):
from google.cloud import firestore
from google.cloud import firestore_v1

self.assertEqual(firestore.__all__, firestore_v1.__all__)

for name in firestore.__all__:
found = getattr(firestore, name)
expected = getattr(firestore_v1, name)
self.assertIs(found, expected)