django-fake-model
Simple library for creating fake models in the unit tests.
This simple library allows to create fake models in your test without migrations, test apps and test tables in your base. All tables that you need will created/removed during the test.
Install
Install django-fake-model:
pip install django-fake-model
Quickstart
Just create a model in any file (Ex: in your test) and add decorator @YourModel.fake_me to test method or test class.
from django_fake_model import models as f
from django.db import models
from django.test import TestCase
class MyFakeModel(f.FakeModel):
name = models.CharField(max_length=100)
@MyFakeModel.fake_me
class MyFakeModelTests(TestCase):
def test_create_model(self):
MyFakeModel.objects.create(name='123')
model = MyFakeModel.objects.get(name='123')
self.assertEqual(model.name, '123')
class MyFakeModelFunctionTest(TestCase):
@MyFakeModel.fake_me
def test_create_model(self):
MyFakeModel.objects.create(name='123')
model = MyFakeModel.objects.get(name='123')
self.assertEqual(model.name, '123')
History
0.1.0 (2015-09-16)
First release on PyPI.
0.1.1 (2015-09-28)
Added tests with different databases.
Metadata
Release files for django-fake-model 0.1.1
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 | |
|---|---|---|---|---|
| django-fake-model-0.1.1.tar.gz | 4.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_fake_model-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / django-fake-model-0.1.1.tar.gz
| Download URL | django-fake-model-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d72e7b278445556829e8108fb95434caaf8875cc73991802e2c8c081e1b1734
|
|
BLAKE2b-256 checksum How to use checksums |
b2492430049bc366d1d4f9e6fa62c8f7dc92ea908772e7a0f9ef4388f3c68044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_fake_model-0.1.1-py2.py3-none-any.whl
| Download URL | django_fake_model-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d2f43723744eff2079563fe78d6859429aefa606aa3ad96deb3e81274a2df528
|
|
BLAKE2b-256 checksum How to use checksums |
70dc25f0ba8c9241c04618bc7e3eb38d85f2f55da4a4a0b0c256f6f9f73fe99c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-fake-model 0.1.1
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.