Skip to main content

Simple library for creating fake models in the unit tests.

Project description

https://badge.fury.io/py/django-fake-model.png https://travis-ci.org/erm0l0v/django-fake-model.png?branch=master

Simple library for creating fake models in the unit tests.

Quickstart

Install django-fake-model:

pip install django-fake-model

Then use it in a project:

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')

Features

  • TODO

Cookiecutter Tools Used in Making This Package

  • cookiecutter

  • cookiecutter-djangopackage

History

0.1.0 (2015-09-16)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-fake-model-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

django_fake_model-0.1.0-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-fake-model-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-fake-model-0.1.0.tar.gz
Algorithm Hash digest
SHA256 89299bd5ee61a41e652f623785edb6aa285c3cff271e1c3cfd7ed4c7dfbf467a
MD5 50eb03b6bf8a4a1e993c22b9bb527fef
BLAKE2b-256 9dfb85d914694bd8982d85cbf53f15fff5c15c4a4a40c18b416de84857c93e90

See more details on using hashes here.

File details

Details for the file django_fake_model-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_fake_model-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 11d6a92e33112f060fc27995ab219138a3d845aacc57ca913708d5cdf19cd95b
MD5 3715793156e79fe55e3feac3ecc96737
BLAKE2b-256 ffc01361346b8aabedcfc9b7b3c888e3e9eb4a10430c2c8589a51c626deea3b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page