Skip to content

In-memory implementation of Google Cloud Firestore for use in tests

License

Notifications You must be signed in to change notification settings

Toku-IA/python-mock-firestore

 
 

Repository files navigation

Python Mock Firestore

An in-memory implementation of the Python client library for Google Cloud Firestore, intended for use in tests to replace the real thing. This project is in early stages and is only a partial implementation of the real client library.

Python 3.10 is required for it to work.

Usage

db = firestore.Client()
mock_db = MockFirestore()

# Can be used in the same way as a firestore.Client() object would be, e.g.:
db.collection('users').get()
mock_db.collection('users').get()

To reset the store to an empty state, use the reset() method:

mock_db = MockFirestore()
mock_db.reset()

Running the tests

  • Create and activate your virtualenv
  • Install dependencies with pip install -r requirements.txt
  • Run tests with python -m unittest discover tests -t /

About

In-memory implementation of Google Cloud Firestore for use in tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%