Skip to content
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
2 changes: 1 addition & 1 deletion firestore/google/cloud/firestore_v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def collections(self):
iterator of subcollections of the current document.
"""
iterator = self._firestore_api.list_collection_ids(
self._database_string, metadata=self._rpc_metadata
"{}/documents".format(self._database_string), metadata=self._rpc_metadata
)
iterator.client = self
iterator.item_to_value = _item_to_collection_ref
Expand Down
5 changes: 5 additions & 0 deletions firestore/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def cleanup():
operation()


def test_collections(client):
collections = list(client.collections())
assert isinstance(collections, list)


def test_create_document(client, cleanup):
now = datetime.datetime.utcnow().replace(tzinfo=UTC)
collection_id = "doc-create" + unique_resource_id("-")
Expand Down
3 changes: 2 additions & 1 deletion firestore/tests/unit/v1/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,9 @@ def _next_page(self):
self.assertEqual(collection.parent, None)
self.assertEqual(collection.id, collection_id)

base_path = client._database_string + "/documents"
firestore_api.list_collection_ids.assert_called_once_with(
client._database_string, metadata=client._rpc_metadata
base_path, metadata=client._rpc_metadata
)

def _get_all_helper(self, client, references, document_pbs, **kwargs):
Expand Down