diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mock-firestore.spec | 474 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 476 insertions, 0 deletions
@@ -0,0 +1 @@ +/mock-firestore-0.11.0.tar.gz diff --git a/python-mock-firestore.spec b/python-mock-firestore.spec new file mode 100644 index 0000000..670186f --- /dev/null +++ b/python-mock-firestore.spec @@ -0,0 +1,474 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mock-firestore +Version: 0.11.0 +Release: 1 +Summary: In-memory implementation of Google Cloud Firestore for use in tests +License: MIT License +URL: https://github.com/mdowds/mock-firestore +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/06/b8/08ccd007d29e7560020b7a9654ea6fbbc6eaf672ad21d0fa03b6867d4a9a/mock-firestore-0.11.0.tar.gz +BuildArch: noarch + + +%description +# Python Mock Firestore + +An in-memory implementation of the [Python client library](https://github.com/googleapis/python-firestore) 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. + +To install: + +`pip install mock-firestore` + +Python 3.6+ is required for it to work. + +## Usage + +```python +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: +```python +mock_db = MockFirestore() +mock_db.reset() +``` + +## Supported operations + +```python +mock_db = MockFirestore() + +# Collections +mock_db.collections() +mock_db.collection('users') +mock_db.collection('users').get() +mock_db.collection('users').list_documents() +mock_db.collection('users').stream() + +# Documents +mock_db.collection('users').document() +mock_db.collection('users').document('alovelace') +mock_db.collection('users').document('alovelace').id +mock_db.collection('users').document('alovelace').parent +mock_db.collection('users').document('alovelace').update_time +mock_db.collection('users').document('alovelace').read_time +mock_db.collection('users').document('alovelace').get() +mock_db.collection('users').document('alovelace').get().exists +mock_db.collection('users').document('alovelace').get().to_dict() +mock_db.collection('users').document('alovelace').set({ + 'first': 'Ada', + 'last': 'Lovelace' +}) +mock_db.collection('users').document('alovelace').set({'first': 'Augusta Ada'}, merge=True) +mock_db.collection('users').document('alovelace').update({'born': 1815}) +mock_db.collection('users').document('alovelace').update({'favourite.color': 'red'}) +mock_db.collection('users').document('alovelace').update({'associates': ['Charles Babbage', 'Michael Faraday']}) +mock_db.collection('users').document('alovelace').collection('friends') +mock_db.collection('users').document('alovelace').delete() +mock_db.collection('users').document(document_id: 'alovelace').delete() +mock_db.collection('users').add({'first': 'Ada', 'last': 'Lovelace'}, 'alovelace') +mock_db.get_all([mock_db.collection('users').document('alovelace')]) +mock_db.document('users/alovelace') +mock_db.document('users/alovelace').update({'born': 1815}) +mock_db.collection('users/alovelace/friends') + +# Querying +mock_db.collection('users').order_by('born').get() +mock_db.collection('users').order_by('born', direction='DESCENDING').get() +mock_db.collection('users').limit(5).get() +mock_db.collection('users').where('born', '==', 1815).get() +mock_db.collection('users').where('born', '!=', 1815).get() +mock_db.collection('users').where('born', '<', 1815).get() +mock_db.collection('users').where('born', '>', 1815).get() +mock_db.collection('users').where('born', '<=', 1815).get() +mock_db.collection('users').where('born', '>=', 1815).get() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('associates', 'array_contains', 'Charles Babbage').stream() +mock_db.collection('users').where('associates', 'array_contains_any', ['Charles Babbage', 'Michael Faraday']).stream() + +# Transforms +mock_db.collection('users').document('alovelace').update({'likes': firestore.Increment(1)}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayUnion(['Andrew Cross', 'Charles Wheatstone'])}) +mock_db.collection('users').document('alovelace').update({firestore.DELETE_FIELD: "born"}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayRemove(['Andrew Cross'])}) + +# Cursors +mock_db.collection('users').start_after({'id': 'alovelace'}).stream() +mock_db.collection('users').end_before({'id': 'alovelace'}).stream() +mock_db.collection('users').end_at({'id': 'alovelace'}).stream() +mock_db.collection('users').start_after(mock_db.collection('users').document('alovelace')).stream() + +# Transactions +transaction = mock_db.transaction() +transaction.id +transaction.in_progress +transaction.get(mock_db.collection('users').where('born', '==', 1815)) +transaction.get(mock_db.collection('users').document('alovelace')) +transaction.get_all([mock_db.collection('users').document('alovelace')]) +transaction.set(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.update(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.delete(mock_db.collection('users').document('alovelace')) +transaction.commit() +``` + +## Running the tests +* Create and activate a virtualenv with a Python version of at least 3.6 +* Install dependencies with `pip install -r requirements-dev-minimal.txt` +* Run tests with `python -m unittest discover tests -t /` + +## Contributors + +* [Matt Dowds](https://github.com/mdowds) +* [Chris Tippett](https://github.com/christippett) +* [Anton Melnikov](https://github.com/notnami) +* [Ben Riggleman](https://github.com/briggleman) +* [Steve Atwell](https://github.com/satwell) +* [ahti123](https://github.com/ahti123) +* [Billcountry Mwaniki](https://github.com/Billcountry) +* [Lucas Moura](https://github.com/lsantosdemoura) +* [Kamil Romaszko](https://github.com/kromash) +* [Anna Melnikov](https://github.com/notnami) +* [Carl Chipperfield](https://github.com/carl-chipperfield) +* [Aaron Loo](https://github.com/domanchi) +* [Kristof Krenn](https://github.com/KrennKristof) +* [Ben Phillips](https://github.com/tavva) +* [Rene Delgado](https://github.com/RDelg) +* [klanderson](https://github.com/klanderson) +* [William Li](https://github.com/wli) +* [Ugo Marchand](https://github.com/UgoM) +* [Bryce Thornton](https://github.com/brycethornton) + + + + +%package -n python3-mock-firestore +Summary: In-memory implementation of Google Cloud Firestore for use in tests +Provides: python-mock-firestore +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mock-firestore +# Python Mock Firestore + +An in-memory implementation of the [Python client library](https://github.com/googleapis/python-firestore) 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. + +To install: + +`pip install mock-firestore` + +Python 3.6+ is required for it to work. + +## Usage + +```python +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: +```python +mock_db = MockFirestore() +mock_db.reset() +``` + +## Supported operations + +```python +mock_db = MockFirestore() + +# Collections +mock_db.collections() +mock_db.collection('users') +mock_db.collection('users').get() +mock_db.collection('users').list_documents() +mock_db.collection('users').stream() + +# Documents +mock_db.collection('users').document() +mock_db.collection('users').document('alovelace') +mock_db.collection('users').document('alovelace').id +mock_db.collection('users').document('alovelace').parent +mock_db.collection('users').document('alovelace').update_time +mock_db.collection('users').document('alovelace').read_time +mock_db.collection('users').document('alovelace').get() +mock_db.collection('users').document('alovelace').get().exists +mock_db.collection('users').document('alovelace').get().to_dict() +mock_db.collection('users').document('alovelace').set({ + 'first': 'Ada', + 'last': 'Lovelace' +}) +mock_db.collection('users').document('alovelace').set({'first': 'Augusta Ada'}, merge=True) +mock_db.collection('users').document('alovelace').update({'born': 1815}) +mock_db.collection('users').document('alovelace').update({'favourite.color': 'red'}) +mock_db.collection('users').document('alovelace').update({'associates': ['Charles Babbage', 'Michael Faraday']}) +mock_db.collection('users').document('alovelace').collection('friends') +mock_db.collection('users').document('alovelace').delete() +mock_db.collection('users').document(document_id: 'alovelace').delete() +mock_db.collection('users').add({'first': 'Ada', 'last': 'Lovelace'}, 'alovelace') +mock_db.get_all([mock_db.collection('users').document('alovelace')]) +mock_db.document('users/alovelace') +mock_db.document('users/alovelace').update({'born': 1815}) +mock_db.collection('users/alovelace/friends') + +# Querying +mock_db.collection('users').order_by('born').get() +mock_db.collection('users').order_by('born', direction='DESCENDING').get() +mock_db.collection('users').limit(5).get() +mock_db.collection('users').where('born', '==', 1815).get() +mock_db.collection('users').where('born', '!=', 1815).get() +mock_db.collection('users').where('born', '<', 1815).get() +mock_db.collection('users').where('born', '>', 1815).get() +mock_db.collection('users').where('born', '<=', 1815).get() +mock_db.collection('users').where('born', '>=', 1815).get() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('associates', 'array_contains', 'Charles Babbage').stream() +mock_db.collection('users').where('associates', 'array_contains_any', ['Charles Babbage', 'Michael Faraday']).stream() + +# Transforms +mock_db.collection('users').document('alovelace').update({'likes': firestore.Increment(1)}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayUnion(['Andrew Cross', 'Charles Wheatstone'])}) +mock_db.collection('users').document('alovelace').update({firestore.DELETE_FIELD: "born"}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayRemove(['Andrew Cross'])}) + +# Cursors +mock_db.collection('users').start_after({'id': 'alovelace'}).stream() +mock_db.collection('users').end_before({'id': 'alovelace'}).stream() +mock_db.collection('users').end_at({'id': 'alovelace'}).stream() +mock_db.collection('users').start_after(mock_db.collection('users').document('alovelace')).stream() + +# Transactions +transaction = mock_db.transaction() +transaction.id +transaction.in_progress +transaction.get(mock_db.collection('users').where('born', '==', 1815)) +transaction.get(mock_db.collection('users').document('alovelace')) +transaction.get_all([mock_db.collection('users').document('alovelace')]) +transaction.set(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.update(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.delete(mock_db.collection('users').document('alovelace')) +transaction.commit() +``` + +## Running the tests +* Create and activate a virtualenv with a Python version of at least 3.6 +* Install dependencies with `pip install -r requirements-dev-minimal.txt` +* Run tests with `python -m unittest discover tests -t /` + +## Contributors + +* [Matt Dowds](https://github.com/mdowds) +* [Chris Tippett](https://github.com/christippett) +* [Anton Melnikov](https://github.com/notnami) +* [Ben Riggleman](https://github.com/briggleman) +* [Steve Atwell](https://github.com/satwell) +* [ahti123](https://github.com/ahti123) +* [Billcountry Mwaniki](https://github.com/Billcountry) +* [Lucas Moura](https://github.com/lsantosdemoura) +* [Kamil Romaszko](https://github.com/kromash) +* [Anna Melnikov](https://github.com/notnami) +* [Carl Chipperfield](https://github.com/carl-chipperfield) +* [Aaron Loo](https://github.com/domanchi) +* [Kristof Krenn](https://github.com/KrennKristof) +* [Ben Phillips](https://github.com/tavva) +* [Rene Delgado](https://github.com/RDelg) +* [klanderson](https://github.com/klanderson) +* [William Li](https://github.com/wli) +* [Ugo Marchand](https://github.com/UgoM) +* [Bryce Thornton](https://github.com/brycethornton) + + + + +%package help +Summary: Development documents and examples for mock-firestore +Provides: python3-mock-firestore-doc +%description help +# Python Mock Firestore + +An in-memory implementation of the [Python client library](https://github.com/googleapis/python-firestore) 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. + +To install: + +`pip install mock-firestore` + +Python 3.6+ is required for it to work. + +## Usage + +```python +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: +```python +mock_db = MockFirestore() +mock_db.reset() +``` + +## Supported operations + +```python +mock_db = MockFirestore() + +# Collections +mock_db.collections() +mock_db.collection('users') +mock_db.collection('users').get() +mock_db.collection('users').list_documents() +mock_db.collection('users').stream() + +# Documents +mock_db.collection('users').document() +mock_db.collection('users').document('alovelace') +mock_db.collection('users').document('alovelace').id +mock_db.collection('users').document('alovelace').parent +mock_db.collection('users').document('alovelace').update_time +mock_db.collection('users').document('alovelace').read_time +mock_db.collection('users').document('alovelace').get() +mock_db.collection('users').document('alovelace').get().exists +mock_db.collection('users').document('alovelace').get().to_dict() +mock_db.collection('users').document('alovelace').set({ + 'first': 'Ada', + 'last': 'Lovelace' +}) +mock_db.collection('users').document('alovelace').set({'first': 'Augusta Ada'}, merge=True) +mock_db.collection('users').document('alovelace').update({'born': 1815}) +mock_db.collection('users').document('alovelace').update({'favourite.color': 'red'}) +mock_db.collection('users').document('alovelace').update({'associates': ['Charles Babbage', 'Michael Faraday']}) +mock_db.collection('users').document('alovelace').collection('friends') +mock_db.collection('users').document('alovelace').delete() +mock_db.collection('users').document(document_id: 'alovelace').delete() +mock_db.collection('users').add({'first': 'Ada', 'last': 'Lovelace'}, 'alovelace') +mock_db.get_all([mock_db.collection('users').document('alovelace')]) +mock_db.document('users/alovelace') +mock_db.document('users/alovelace').update({'born': 1815}) +mock_db.collection('users/alovelace/friends') + +# Querying +mock_db.collection('users').order_by('born').get() +mock_db.collection('users').order_by('born', direction='DESCENDING').get() +mock_db.collection('users').limit(5).get() +mock_db.collection('users').where('born', '==', 1815).get() +mock_db.collection('users').where('born', '!=', 1815).get() +mock_db.collection('users').where('born', '<', 1815).get() +mock_db.collection('users').where('born', '>', 1815).get() +mock_db.collection('users').where('born', '<=', 1815).get() +mock_db.collection('users').where('born', '>=', 1815).get() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('born', 'in', [1815, 1900]).stream() +mock_db.collection('users').where('associates', 'array_contains', 'Charles Babbage').stream() +mock_db.collection('users').where('associates', 'array_contains_any', ['Charles Babbage', 'Michael Faraday']).stream() + +# Transforms +mock_db.collection('users').document('alovelace').update({'likes': firestore.Increment(1)}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayUnion(['Andrew Cross', 'Charles Wheatstone'])}) +mock_db.collection('users').document('alovelace').update({firestore.DELETE_FIELD: "born"}) +mock_db.collection('users').document('alovelace').update({'associates': firestore.ArrayRemove(['Andrew Cross'])}) + +# Cursors +mock_db.collection('users').start_after({'id': 'alovelace'}).stream() +mock_db.collection('users').end_before({'id': 'alovelace'}).stream() +mock_db.collection('users').end_at({'id': 'alovelace'}).stream() +mock_db.collection('users').start_after(mock_db.collection('users').document('alovelace')).stream() + +# Transactions +transaction = mock_db.transaction() +transaction.id +transaction.in_progress +transaction.get(mock_db.collection('users').where('born', '==', 1815)) +transaction.get(mock_db.collection('users').document('alovelace')) +transaction.get_all([mock_db.collection('users').document('alovelace')]) +transaction.set(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.update(mock_db.collection('users').document('alovelace'), {'born': 1815}) +transaction.delete(mock_db.collection('users').document('alovelace')) +transaction.commit() +``` + +## Running the tests +* Create and activate a virtualenv with a Python version of at least 3.6 +* Install dependencies with `pip install -r requirements-dev-minimal.txt` +* Run tests with `python -m unittest discover tests -t /` + +## Contributors + +* [Matt Dowds](https://github.com/mdowds) +* [Chris Tippett](https://github.com/christippett) +* [Anton Melnikov](https://github.com/notnami) +* [Ben Riggleman](https://github.com/briggleman) +* [Steve Atwell](https://github.com/satwell) +* [ahti123](https://github.com/ahti123) +* [Billcountry Mwaniki](https://github.com/Billcountry) +* [Lucas Moura](https://github.com/lsantosdemoura) +* [Kamil Romaszko](https://github.com/kromash) +* [Anna Melnikov](https://github.com/notnami) +* [Carl Chipperfield](https://github.com/carl-chipperfield) +* [Aaron Loo](https://github.com/domanchi) +* [Kristof Krenn](https://github.com/KrennKristof) +* [Ben Phillips](https://github.com/tavva) +* [Rene Delgado](https://github.com/RDelg) +* [klanderson](https://github.com/klanderson) +* [William Li](https://github.com/wli) +* [Ugo Marchand](https://github.com/UgoM) +* [Bryce Thornton](https://github.com/brycethornton) + + + + +%prep +%autosetup -n mock-firestore-0.11.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mock-firestore -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.11.0-1 +- Package Spec generated @@ -0,0 +1 @@ +f667705f360ca8ae21adb3d037bc182b mock-firestore-0.11.0.tar.gz |