django-tdd

Solid

Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.

Testing & QA 496 stars 41 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 86/100

Stars 20%
90
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Django Testing with TDD Test-driven development for Django applications using pytest, factory_boy, and Django REST Framework. ## When to Activate - Writing new Django applications - Implementing Django REST Framework APIs - Testing Django models, views, and serializers - Setting up testing infrastructure for Django projects ## TDD Workflow for Django ### Red-Green-Refactor Cycle ```python # Step 1: RED - Write failing test def test_user_creation(): user = User.objects.create_user(email='test@example.com', password='testpass123') assert user.email == 'test@example.com' assert user.check_password('testpass123') assert not user.is_staff # Step 2: GREEN - Make test pass # Create User model or factory # Step 3: REFACTOR - Improve while keeping tests green ``` ## Setup ### pytest Configuration ```ini # pytest.ini [pytest] DJANGO_SETTINGS_MODULE = config.settings.test testpaths = tests python_files = test_*.py python_classes = Test* python_functions = test_* addopts = --reuse-db --nomigrations --cov=apps --cov-report=html --cov-report=term-missing --strict-markers markers = slow: marks tests as slow integration: marks tests as integration tests ``` ### Test Settings ```python # config/settings/test.py from .base import * DEBUG = True DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } # Disa...

Details

Author
vibeeval
Repository
vibeeval/vibecosystem
Created
2 months ago
Last Updated
1 months ago
Language
C#
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category