Skip to content

Commit

Permalink
add kwargs to doc ref
Browse files Browse the repository at this point in the history
  • Loading branch information
bschreck committed Feb 5, 2024
1 parent 6457932 commit 04b3463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mockfirestore/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def id(self):
def path(self):
return '/'.join(self._path)

def get(self) -> DocumentSnapshot:
def get(self, **kwargs) -> DocumentSnapshot:
return DocumentSnapshot(self, get_by_path(self._data, self._path))

def delete(self):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_document_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ def test_get_document_by_path(self):
self.assertEqual({'id': 1}, doc.to_dict())
self.assertEqual('first', doc.id)

def test_get_document_by_path_with_transaction_kwarg(self):
fs = MockFirestore()
fs._data = {'foo': {
'first': {'id': 1}
}}
doc = fs.document('foo/first').get(transaction='tx')
self.assertEqual({'id': 1}, doc.to_dict())
self.assertEqual('first', doc.id)

def test_document_path_property(self):
fs = MockFirestore()
fs._data = {'foo': {
Expand Down

0 comments on commit 04b3463

Please sign in to comment.