All Projects → paulocheque → Django Dynamic Fixture

paulocheque / Django Dynamic Fixture

Licence: other
A complete library to create dynamic model instances for testing purposes.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Dynamic Fixture

Mixer
Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Stars: ✭ 743 (+117.89%)
Mutual labels:  django, testing-tools
Django Tailwind
Django + Tailwind CSS = ❤
Stars: ✭ 333 (-2.35%)
Mutual labels:  django
Model bakery
Object factory for Django
Stars: ✭ 328 (-3.81%)
Mutual labels:  django
Django Apscheduler
APScheduler for Django
Stars: ✭ 334 (-2.05%)
Mutual labels:  django
Watcher
Watcher - Open Source Cybersecurity Threat Hunting Platform. Developed with Django & React JS.
Stars: ✭ 324 (-4.99%)
Mutual labels:  django
Docker Django Nginx Uwsgi Postgres Tutorial
Docker + Django + Nginx + uWSGI + Postgres 基本教學 - 從無到有 ( Docker + Django + Nginx + uWSGI + Postgres Tutorial )
Stars: ✭ 334 (-2.05%)
Mutual labels:  django
Awesome Cheatsheets
👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
Stars: ✭ 26,007 (+7526.69%)
Mutual labels:  django
Autoops
linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台 本项目已停止开发!因长时间未对代码进行维护,可能会造成项目在不同环境上无法部署、运行BUG等问题,请知晓!项目仅供参考!
Stars: ✭ 340 (-0.29%)
Mutual labels:  django
Django Classy Tags
Class based template tags for django
Stars: ✭ 339 (-0.59%)
Mutual labels:  django
Grpcox
Like Postman, but for gRPC: web based GUI client for gRPC Development Testing
Stars: ✭ 333 (-2.35%)
Mutual labels:  testing-tools
Htrace.sh
My simple Swiss Army knife for http/https troubleshooting and profiling.
Stars: ✭ 3,465 (+916.13%)
Mutual labels:  testing-tools
Speakerfight
The Easier way to choose the best talks.
Stars: ✭ 330 (-3.23%)
Mutual labels:  django
Nsot
Network Source of Truth is an open source IPAM and network inventory database
Stars: ✭ 337 (-1.17%)
Mutual labels:  django
Dsmr Reader
DSMR-protocol reader, telegram data storage and energy consumption visualizer. Can be used for reading the smart meter DSMR (Dutch Smart Meter Requirements) P1 port yourself at your home. You will need a cable and hardware that can run Linux software. Free for non-commercial use. A Docker implementation can be found here: https://github.com/xirixiz/dsmr-reader-docker
Stars: ✭ 327 (-4.11%)
Mutual labels:  django
Try Django 2.2
Try Django 2.2 is step-by-step to build a modern, fully open-source, Blog web application using Python, Django, Bootstrap, Javascript, and more.
Stars: ✭ 338 (-0.88%)
Mutual labels:  django
Django Concurrency
Optimistic lock implementation for Django. Prevents users from doing concurrent editing.
Stars: ✭ 327 (-4.11%)
Mutual labels:  django
Cortado
Android Espresso made more fluent ☕️
Stars: ✭ 332 (-2.64%)
Mutual labels:  testing-tools
Tlsfuzzer
SSL and TLS protocol test suite and fuzzer
Stars: ✭ 335 (-1.76%)
Mutual labels:  testing-tools
Graphene Django
Integrate GraphQL into your Django project.
Stars: ✭ 3,738 (+996.19%)
Mutual labels:  django
Django Celery Results
Celery result back end with django
Stars: ✭ 337 (-1.17%)
Mutual labels:  django

Django Dynamic Fixture

Build Status Docs Status Coverage Status PyPI version PyPI - Python Version PyPI - Downloads

Latest version: 3.1.1 (Nov 2020)

Django Dynamic Fixture (DDF) is a complete and simple library to create dynamic model instances for testing purposes.

It lets you focus on your tests, instead of focusing on generating some dummy data which is boring and polutes the test source code.

Basic Examples

Customize only the important details of the test:

    from ddf import G
    from my_library import Author, Book

    def test_search_book_by_author():
        author1 = G(Author)
        author2 = G(Author)
        book1 = G(Book, authors=[author1])
        book2 = G(Book, authors=[author2])
        books = Book.objects.search_by_author(author1.name)
        assert book1 in books
        assert book2 not in books

Using some goodies to keep the test code smaller:

    from ddf import G

    def test_search_book_by_author():
        author1, author2 = G('my_library.Author', n=2)
        book1 = G('my_library.Book', authors=[author1])
        book2 = G('my_library.Book', authors=[author2])
        books = Book.objects.search_by_author(author1.name)
        assert book1 in books
        assert book2 not in books

Configuring data from relationship fields:

    from ddf import G

    def test_search_book_by_author():
        book1 = G(Book, main_author__name='Eistein')
        book2 = G(Book)
        books = Book.objects.search_by_author(book1.main_author.name)
        assert book1 in books
        assert book2 not in books
        assert book1.main_author.name == 'Eistein'

Cheat Sheet

# Import the main DDF features
from ddf import N, G, F, M, C, P, teach # meaning: New, Get, ForeignKey, Mask, Copier, Print, teach
# `N` creates an instance of model without saving it to DB
instance = N(Book)
# `G` creates an instance of model and save it into the DB
instance = G(Book)
# `F` customize relationship objects
instance = G(Book, author=F(name='Eistein'))
# Same as `F`
instance = G(Book, author__name='Eistein')
# `M` receives a data mask and create a random string using it
# Known symbols: `_`, `#` or `-`
# To escape known symbols: `!`
instance = N(Book, address=M('Street ___, ### !- --'))
assert instance.address == 'Street TPA, 632 - BR'
# `C` copies data from one field to another
instance = N(Book, address_formatted=C('address'), address=M('Street ___, ### \- --'))
assert instance.address_formatted == 'Street TPA, 632 - BR'
# `teach` teaches DDF in how to build an instance
teach(Book, address=M('Street ___, ### !- --'))
instance = G(Book)
assert instance.address == 'Street TPA, 632 - BR'
# `P` print instance values for debugging
P(instance)
import ddf
ddf.__version__
from ddf import ddf_check_models
succeeded, errors = ddf_check_models()
succeeded, errors = ddf_check_models(print_csv=True)
succeeded, errors = ddf_check_models(csv_filename='ddf_compatibility_report.csv')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].