[](https://travis-ci.org/James1345/white-noise)
Test Data generator for SQLAlchemy and Django
This package is designed to make it easy to generate test data for SQLAlchemy
or Django applications. It was inspired after spending
most of a day failing to get Mixer working properly.
The aim is to have a consistant, simple API for all generation.
## API overview
Fixtures define the data that should be entered into the database. Generators
create the data and a fixture runner enters it.
### Fixtures
A fixture object takes 4 parameters.
- **model** The model to be acted on. This
should be a direct reference to the model class that data should be created for.
- **quantity** How many instances of the model need adding to the database
- **dependencies** A list of fixtures that this fixture depends on. The base for fixture runners can resolve dependencies to ensure fixtures are ruin in the correct order
- **fields** This is a dictionary of field names to generator instances. The field name is the field of the model to be generated, where generator is a generator to be used (it is normal to instansiate the generator in the fields list)
### Generators
Currently available generators (and their options)
#### LiteralGenerator
Returns a literal value that is passed
- **value** The value to return
#### RandomGenerator
Creates a random string for the field
- **length** The length of the field
#### LipsumGenerator
Creates a semi-random string sentence of the Lorem Ipsum form
#### InsultGenerator
Creates a random insulting sentence string for the field
#### SequenceGenerator
Iterates over a sequence. Loops if the end of the sequence is reached.
- **values** The values to use. Can be any iterable (lists, tuples, generators, etc.)
#### sqlalchemy.SelectGenerator
Selects an object from the database and uses that as the value for the field
This is for creating objects with relationships to others in the database (e.g. foreign keys)
This generator only works with the SQLAlchemy fixture runner. (if writting your own fixture runner
it must receive an SQLAlchemy session object as well as its options)
- **model** The foreign model to select from
- **random** Select randomly or select the first (default => random)
### Fixture runners
#### SQLAlchemyFixtureRunner
Runs the fixtures using SQLAlchemy models. This class must be instantiated with
a reference to a SQLAlchemy session object to be used for accessing the database
#### DjangoFixtureRunner
Runs the fixtures against a Django database. It must be run in a django context
(e.g. from a custom management command)
A Django management command is included. To use it, add `'whitenoise'` to your
installed apps
Metadata
Release files for White-Noise 0.1.0
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 |
|---|---|---|---|---|
| White Noise-0.1.0.tar.gz | 6.6 kB | Without provenance | Details for White Noise-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| White_Noise-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for White_Noise-0.1.0-py3-none-any.whl |
Total release size: 16.4 kB
Release files / White Noise-0.1.0.tar.gz
| Download URL | White Noise-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfbce6c781afcd24a3dfa2a17b9be8103a6fa646a28d7babf9924a0613dd4aeb
|
|
BLAKE2b-256 checksum How to use checksums |
13b7177a46ab62adbc87136a17ad7c7dc76c1be093de0258d413fedff83f1c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / White_Noise-0.1.0-py3-none-any.whl
| Download URL | White_Noise-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71624b772fe5907b29fe5d94f9ac773bf25472105cd18fae9bba063bb214a3e5
|
|
BLAKE2b-256 checksum How to use checksums |
621de93fb78a1e041b8ed8602e2ec43fa23c5c5b993e6a24e7f702a4c9d5c07a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for White-Noise 0.1.0
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.