Skip to content

Commit

Permalink
Add missing transforms to 'google.cloud.firestore' shim. (#8481)
Browse files Browse the repository at this point in the history
Add a unit test that asserts the shim stays in sync with
'google.cloud.firestore_v1'.

Closes #8173.
  • Loading branch information
tseaver authored Jul 2, 2019
1 parent e3e6382 commit 2d7aff4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
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)

0 comments on commit 2d7aff4

Please sign in to comment.