MongoDB Test Util
================
This library provides a handful of useful functionality for easing the testing
of systems that rely on *MongoDB* as a datastore
-------------------------
Start and Teardown mongod
-------------------------
For most use cases, you can use this snippet to startup a ``mongod`` instance
for your test environment::
from mongo_test.handlers import startup_handle
startup_handle()
To tear an instance down if one exists::
from mongo_test.handlers import teardown_handle
teardown_handle()
--------
Fixtures
--------
*MongoTest* allows you to specify fixtures in *yaml*, with a few conveniences.
A sample yaml file would look something like::
`user_fixture.yml`
configuration:
collection: users
drop: true
simple_user:
_id: !oid 1
username: idbentley
first_name: Ian
last_name: Bentley
``!oid`` is a custom *yaml* constructor provided by *MongoTest*. This constructor
allows you to create object ids based on an integer seed. You can access the
constructor directly from python, which allows you to write assertions on
document identity::
from mongo_test.fixtures import oid_con
user = db.coll.find({name: 'ian.bentley@gmail.com'})
assert user['_id'] = oid_con(1)
------------------
A complete example
------------------
See the tests for a complete simple example.
Metadata
Release files for MongoTest 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| MongoTest-0.1.2.tar.gz | 3.7 kB | Without provenance | Details for MongoTest-0.1.2.tar.gz |
Release files / MongoTest-0.1.2.tar.gz
| Download URL | MongoTest-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ef84129876c3305272a635cc57705067f6f8a8fff5764fb2877a9fe4ccac29c
|
|
BLAKE2b-256 checksum How to use checksums |
daf22cc94307b4b235f27f1e30846d49e55684d4591ccee9acf13d936f9dd99d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for MongoTest 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.